content
stringlengths 5
1.04M
| avg_line_length
float64 1.75
12.9k
| max_line_length
int64 2
244k
| alphanum_fraction
float64 0
0.98
| licenses
sequence | repository_name
stringlengths 7
92
| path
stringlengths 3
249
| size
int64 5
1.04M
| lang
stringclasses 2
values |
---|---|---|---|---|---|---|---|---|
_ln: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
#include "stat.h"
#include "user.h"
int
main(int argc, char *argv[])
{
0: f3 0f 1e fb endbr32
4: 8d 4c 24 04 lea 0x4(%esp),%ecx
8: 83 e4 f0 and $0xfffffff0,%esp
b: ff 71 fc pushl -0x4(%ecx)
if(argc != 3){
e: 83 39 03 cmpl $0x3,(%ecx)
{
11: 55 push %ebp
12: 89 e5 mov %esp,%ebp
14: 53 push %ebx
15: 51 push %ecx
16: 8b 59 04 mov 0x4(%ecx),%ebx
if(argc != 3){
19: 74 13 je 2e <main+0x2e>
printf(2, "Usage: ln old new\n");
1b: 52 push %edx
1c: 52 push %edx
1d: 68 48 08 00 00 push $0x848
22: 6a 02 push $0x2
24: e8 57 06 00 00 call 680 <printf>
exit();
29: e8 df 04 00 00 call 50d <exit>
}
if(link(argv[1], argv[2]) < 0)
2e: 50 push %eax
2f: 50 push %eax
30: ff 73 08 pushl 0x8(%ebx)
33: ff 73 04 pushl 0x4(%ebx)
36: e8 32 05 00 00 call 56d <link>
3b: 83 c4 10 add $0x10,%esp
3e: 85 c0 test %eax,%eax
40: 78 05 js 47 <main+0x47>
printf(2, "link %s %s: failed\n", argv[1], argv[2]);
exit();
42: e8 c6 04 00 00 call 50d <exit>
printf(2, "link %s %s: failed\n", argv[1], argv[2]);
47: ff 73 08 pushl 0x8(%ebx)
4a: ff 73 04 pushl 0x4(%ebx)
4d: 68 5b 08 00 00 push $0x85b
52: 6a 02 push $0x2
54: e8 27 06 00 00 call 680 <printf>
59: 83 c4 10 add $0x10,%esp
5c: eb e4 jmp 42 <main+0x42>
5e: 66 90 xchg %ax,%ax
00000060 <strcpy>:
};
char*
strcpy(char *s, const char *t)
{
60: f3 0f 1e fb endbr32
64: 55 push %ebp
char *os;
os = s;
while((*s++ = *t++) != 0)
65: 31 c0 xor %eax,%eax
{
67: 89 e5 mov %esp,%ebp
69: 53 push %ebx
6a: 8b 4d 08 mov 0x8(%ebp),%ecx
6d: 8b 5d 0c mov 0xc(%ebp),%ebx
while((*s++ = *t++) != 0)
70: 0f b6 14 03 movzbl (%ebx,%eax,1),%edx
74: 88 14 01 mov %dl,(%ecx,%eax,1)
77: 83 c0 01 add $0x1,%eax
7a: 84 d2 test %dl,%dl
7c: 75 f2 jne 70 <strcpy+0x10>
;
return os;
}
7e: 89 c8 mov %ecx,%eax
80: 5b pop %ebx
81: 5d pop %ebp
82: c3 ret
83: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
8a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
00000090 <strcmp>:
int
strcmp(const char *p, const char *q)
{
90: f3 0f 1e fb endbr32
94: 55 push %ebp
95: 89 e5 mov %esp,%ebp
97: 53 push %ebx
98: 8b 4d 08 mov 0x8(%ebp),%ecx
9b: 8b 55 0c mov 0xc(%ebp),%edx
while(*p && *p == *q)
9e: 0f b6 01 movzbl (%ecx),%eax
a1: 0f b6 1a movzbl (%edx),%ebx
a4: 84 c0 test %al,%al
a6: 75 19 jne c1 <strcmp+0x31>
a8: eb 26 jmp d0 <strcmp+0x40>
aa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
b0: 0f b6 41 01 movzbl 0x1(%ecx),%eax
p++, q++;
b4: 83 c1 01 add $0x1,%ecx
b7: 83 c2 01 add $0x1,%edx
while(*p && *p == *q)
ba: 0f b6 1a movzbl (%edx),%ebx
bd: 84 c0 test %al,%al
bf: 74 0f je d0 <strcmp+0x40>
c1: 38 d8 cmp %bl,%al
c3: 74 eb je b0 <strcmp+0x20>
return (uchar)*p - (uchar)*q;
c5: 29 d8 sub %ebx,%eax
}
c7: 5b pop %ebx
c8: 5d pop %ebp
c9: c3 ret
ca: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
d0: 31 c0 xor %eax,%eax
return (uchar)*p - (uchar)*q;
d2: 29 d8 sub %ebx,%eax
}
d4: 5b pop %ebx
d5: 5d pop %ebp
d6: c3 ret
d7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
de: 66 90 xchg %ax,%ax
000000e0 <strlen>:
uint
strlen(const char *s)
{
e0: f3 0f 1e fb endbr32
e4: 55 push %ebp
e5: 89 e5 mov %esp,%ebp
e7: 8b 55 08 mov 0x8(%ebp),%edx
int n;
for(n = 0; s[n]; n++)
ea: 80 3a 00 cmpb $0x0,(%edx)
ed: 74 21 je 110 <strlen+0x30>
ef: 31 c0 xor %eax,%eax
f1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
f8: 83 c0 01 add $0x1,%eax
fb: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1)
ff: 89 c1 mov %eax,%ecx
101: 75 f5 jne f8 <strlen+0x18>
;
return n;
}
103: 89 c8 mov %ecx,%eax
105: 5d pop %ebp
106: c3 ret
107: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
10e: 66 90 xchg %ax,%ax
for(n = 0; s[n]; n++)
110: 31 c9 xor %ecx,%ecx
}
112: 5d pop %ebp
113: 89 c8 mov %ecx,%eax
115: c3 ret
116: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
11d: 8d 76 00 lea 0x0(%esi),%esi
00000120 <memset>:
void*
memset(void *dst, int c, uint n)
{
120: f3 0f 1e fb endbr32
124: 55 push %ebp
125: 89 e5 mov %esp,%ebp
127: 57 push %edi
128: 8b 55 08 mov 0x8(%ebp),%edx
}
static inline void
stosb(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosb" :
12b: 8b 4d 10 mov 0x10(%ebp),%ecx
12e: 8b 45 0c mov 0xc(%ebp),%eax
131: 89 d7 mov %edx,%edi
133: fc cld
134: f3 aa rep stos %al,%es:(%edi)
stosb(dst, c, n);
return dst;
}
136: 89 d0 mov %edx,%eax
138: 5f pop %edi
139: 5d pop %ebp
13a: c3 ret
13b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
13f: 90 nop
00000140 <strchr>:
char*
strchr(const char *s, char c)
{
140: f3 0f 1e fb endbr32
144: 55 push %ebp
145: 89 e5 mov %esp,%ebp
147: 8b 45 08 mov 0x8(%ebp),%eax
14a: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx
for(; *s; s++)
14e: 0f b6 10 movzbl (%eax),%edx
151: 84 d2 test %dl,%dl
153: 75 16 jne 16b <strchr+0x2b>
155: eb 21 jmp 178 <strchr+0x38>
157: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
15e: 66 90 xchg %ax,%ax
160: 0f b6 50 01 movzbl 0x1(%eax),%edx
164: 83 c0 01 add $0x1,%eax
167: 84 d2 test %dl,%dl
169: 74 0d je 178 <strchr+0x38>
if(*s == c)
16b: 38 d1 cmp %dl,%cl
16d: 75 f1 jne 160 <strchr+0x20>
return (char*)s;
return 0;
}
16f: 5d pop %ebp
170: c3 ret
171: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
return 0;
178: 31 c0 xor %eax,%eax
}
17a: 5d pop %ebp
17b: c3 ret
17c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00000180 <gets>:
char*
gets(char *buf, int max)
{
180: f3 0f 1e fb endbr32
184: 55 push %ebp
185: 89 e5 mov %esp,%ebp
187: 57 push %edi
188: 56 push %esi
int i, cc;
char c;
for(i=0; i+1 < max; ){
189: 31 f6 xor %esi,%esi
{
18b: 53 push %ebx
18c: 89 f3 mov %esi,%ebx
18e: 83 ec 1c sub $0x1c,%esp
191: 8b 7d 08 mov 0x8(%ebp),%edi
for(i=0; i+1 < max; ){
194: eb 33 jmp 1c9 <gets+0x49>
196: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
19d: 8d 76 00 lea 0x0(%esi),%esi
cc = read(0, &c, 1);
1a0: 83 ec 04 sub $0x4,%esp
1a3: 8d 45 e7 lea -0x19(%ebp),%eax
1a6: 6a 01 push $0x1
1a8: 50 push %eax
1a9: 6a 00 push $0x0
1ab: e8 75 03 00 00 call 525 <read>
if(cc < 1)
1b0: 83 c4 10 add $0x10,%esp
1b3: 85 c0 test %eax,%eax
1b5: 7e 1c jle 1d3 <gets+0x53>
break;
buf[i++] = c;
1b7: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
1bb: 83 c7 01 add $0x1,%edi
1be: 88 47 ff mov %al,-0x1(%edi)
if(c == '\n' || c == '\r')
1c1: 3c 0a cmp $0xa,%al
1c3: 74 23 je 1e8 <gets+0x68>
1c5: 3c 0d cmp $0xd,%al
1c7: 74 1f je 1e8 <gets+0x68>
for(i=0; i+1 < max; ){
1c9: 83 c3 01 add $0x1,%ebx
1cc: 89 fe mov %edi,%esi
1ce: 3b 5d 0c cmp 0xc(%ebp),%ebx
1d1: 7c cd jl 1a0 <gets+0x20>
1d3: 89 f3 mov %esi,%ebx
break;
}
buf[i] = '\0';
return buf;
}
1d5: 8b 45 08 mov 0x8(%ebp),%eax
buf[i] = '\0';
1d8: c6 03 00 movb $0x0,(%ebx)
}
1db: 8d 65 f4 lea -0xc(%ebp),%esp
1de: 5b pop %ebx
1df: 5e pop %esi
1e0: 5f pop %edi
1e1: 5d pop %ebp
1e2: c3 ret
1e3: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
1e7: 90 nop
1e8: 8b 75 08 mov 0x8(%ebp),%esi
1eb: 8b 45 08 mov 0x8(%ebp),%eax
1ee: 01 de add %ebx,%esi
1f0: 89 f3 mov %esi,%ebx
buf[i] = '\0';
1f2: c6 03 00 movb $0x0,(%ebx)
}
1f5: 8d 65 f4 lea -0xc(%ebp),%esp
1f8: 5b pop %ebx
1f9: 5e pop %esi
1fa: 5f pop %edi
1fb: 5d pop %ebp
1fc: c3 ret
1fd: 8d 76 00 lea 0x0(%esi),%esi
00000200 <stat>:
int
stat(const char *n, struct stat *st)
{
200: f3 0f 1e fb endbr32
204: 55 push %ebp
205: 89 e5 mov %esp,%ebp
207: 56 push %esi
208: 53 push %ebx
int fd;
int r;
fd = open(n, O_RDONLY);
209: 83 ec 08 sub $0x8,%esp
20c: 6a 00 push $0x0
20e: ff 75 08 pushl 0x8(%ebp)
211: e8 37 03 00 00 call 54d <open>
if(fd < 0)
216: 83 c4 10 add $0x10,%esp
219: 85 c0 test %eax,%eax
21b: 78 2b js 248 <stat+0x48>
return -1;
r = fstat(fd, st);
21d: 83 ec 08 sub $0x8,%esp
220: ff 75 0c pushl 0xc(%ebp)
223: 89 c3 mov %eax,%ebx
225: 50 push %eax
226: e8 3a 03 00 00 call 565 <fstat>
close(fd);
22b: 89 1c 24 mov %ebx,(%esp)
r = fstat(fd, st);
22e: 89 c6 mov %eax,%esi
close(fd);
230: e8 00 03 00 00 call 535 <close>
return r;
235: 83 c4 10 add $0x10,%esp
}
238: 8d 65 f8 lea -0x8(%ebp),%esp
23b: 89 f0 mov %esi,%eax
23d: 5b pop %ebx
23e: 5e pop %esi
23f: 5d pop %ebp
240: c3 ret
241: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
return -1;
248: be ff ff ff ff mov $0xffffffff,%esi
24d: eb e9 jmp 238 <stat+0x38>
24f: 90 nop
00000250 <atoi>:
int
atoi(const char *s)
{
250: f3 0f 1e fb endbr32
254: 55 push %ebp
255: 89 e5 mov %esp,%ebp
257: 53 push %ebx
258: 8b 55 08 mov 0x8(%ebp),%edx
int n;
n = 0;
while('0' <= *s && *s <= '9')
25b: 0f be 02 movsbl (%edx),%eax
25e: 8d 48 d0 lea -0x30(%eax),%ecx
261: 80 f9 09 cmp $0x9,%cl
n = 0;
264: b9 00 00 00 00 mov $0x0,%ecx
while('0' <= *s && *s <= '9')
269: 77 1a ja 285 <atoi+0x35>
26b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
26f: 90 nop
n = n*10 + *s++ - '0';
270: 83 c2 01 add $0x1,%edx
273: 8d 0c 89 lea (%ecx,%ecx,4),%ecx
276: 8d 4c 48 d0 lea -0x30(%eax,%ecx,2),%ecx
while('0' <= *s && *s <= '9')
27a: 0f be 02 movsbl (%edx),%eax
27d: 8d 58 d0 lea -0x30(%eax),%ebx
280: 80 fb 09 cmp $0x9,%bl
283: 76 eb jbe 270 <atoi+0x20>
return n;
}
285: 89 c8 mov %ecx,%eax
287: 5b pop %ebx
288: 5d pop %ebp
289: c3 ret
28a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
00000290 <memmove>:
void*
memmove(void *vdst, const void *vsrc, int n)
{
290: f3 0f 1e fb endbr32
294: 55 push %ebp
295: 89 e5 mov %esp,%ebp
297: 57 push %edi
298: 8b 45 10 mov 0x10(%ebp),%eax
29b: 8b 55 08 mov 0x8(%ebp),%edx
29e: 56 push %esi
29f: 8b 75 0c mov 0xc(%ebp),%esi
char *dst;
const char *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
2a2: 85 c0 test %eax,%eax
2a4: 7e 0f jle 2b5 <memmove+0x25>
2a6: 01 d0 add %edx,%eax
dst = vdst;
2a8: 89 d7 mov %edx,%edi
2aa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
*dst++ = *src++;
2b0: a4 movsb %ds:(%esi),%es:(%edi)
while(n-- > 0)
2b1: 39 f8 cmp %edi,%eax
2b3: 75 fb jne 2b0 <memmove+0x20>
return vdst;
}
2b5: 5e pop %esi
2b6: 89 d0 mov %edx,%eax
2b8: 5f pop %edi
2b9: 5d pop %ebp
2ba: c3 ret
2bb: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
2bf: 90 nop
000002c0 <thread_join>:
void* stack;
stack =malloc(4096); //pgsize
return clone(start_routine,arg1,arg2,stack);
}
int thread_join()
{
2c0: f3 0f 1e fb endbr32
2c4: 55 push %ebp
2c5: 89 e5 mov %esp,%ebp
2c7: 83 ec 24 sub $0x24,%esp
void * stackPtr;
int x = join(&stackPtr);
2ca: 8d 45 f4 lea -0xc(%ebp),%eax
2cd: 50 push %eax
2ce: e8 f2 02 00 00 call 5c5 <join>
return x;
}
2d3: c9 leave
2d4: c3 ret
2d5: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
2dc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
000002e0 <lock_init>:
void lock_init(struct lock_t *lk){
2e0: f3 0f 1e fb endbr32
2e4: 55 push %ebp
2e5: 89 e5 mov %esp,%ebp
lk->locked=0; //intialize as unnlocked
2e7: 8b 45 08 mov 0x8(%ebp),%eax
2ea: c7 00 00 00 00 00 movl $0x0,(%eax)
}
2f0: 5d pop %ebp
2f1: c3 ret
2f2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
2f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000300 <lock_acquire>:
void lock_acquire(struct lock_t *lk){
300: f3 0f 1e fb endbr32
304: 55 push %ebp
xchg(volatile uint *addr, uint newval)
{
uint result;
// The + in "+m" denotes a read-modify-write operand.
asm volatile("lock; xchgl %0, %1" :
305: b9 01 00 00 00 mov $0x1,%ecx
30a: 89 e5 mov %esp,%ebp
30c: 8b 55 08 mov 0x8(%ebp),%edx
30f: 90 nop
310: 89 c8 mov %ecx,%eax
312: f0 87 02 lock xchg %eax,(%edx)
while(xchg(&lk->locked,1) != 0);
315: 85 c0 test %eax,%eax
317: 75 f7 jne 310 <lock_acquire+0x10>
}
319: 5d pop %ebp
31a: c3 ret
31b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
31f: 90 nop
00000320 <lock_release>:
void lock_release(struct lock_t *lk){
320: f3 0f 1e fb endbr32
324: 55 push %ebp
325: 31 c0 xor %eax,%eax
327: 89 e5 mov %esp,%ebp
329: 8b 55 08 mov 0x8(%ebp),%edx
32c: f0 87 02 lock xchg %eax,(%edx)
xchg(&lk->locked,0) ;
}
32f: 5d pop %ebp
330: c3 ret
331: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
338: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
33f: 90 nop
00000340 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
340: f3 0f 1e fb endbr32
344: 55 push %ebp
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
345: a1 c4 0b 00 00 mov 0xbc4,%eax
{
34a: 89 e5 mov %esp,%ebp
34c: 57 push %edi
34d: 56 push %esi
34e: 53 push %ebx
34f: 8b 5d 08 mov 0x8(%ebp),%ebx
352: 8b 10 mov (%eax),%edx
bp = (Header*)ap - 1;
354: 8d 4b f8 lea -0x8(%ebx),%ecx
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
357: 39 c8 cmp %ecx,%eax
359: 73 15 jae 370 <free+0x30>
35b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
35f: 90 nop
360: 39 d1 cmp %edx,%ecx
362: 72 14 jb 378 <free+0x38>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
364: 39 d0 cmp %edx,%eax
366: 73 10 jae 378 <free+0x38>
{
368: 89 d0 mov %edx,%eax
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
36a: 8b 10 mov (%eax),%edx
36c: 39 c8 cmp %ecx,%eax
36e: 72 f0 jb 360 <free+0x20>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
370: 39 d0 cmp %edx,%eax
372: 72 f4 jb 368 <free+0x28>
374: 39 d1 cmp %edx,%ecx
376: 73 f0 jae 368 <free+0x28>
break;
if(bp + bp->s.size == p->s.ptr){
378: 8b 73 fc mov -0x4(%ebx),%esi
37b: 8d 3c f1 lea (%ecx,%esi,8),%edi
37e: 39 fa cmp %edi,%edx
380: 74 1e je 3a0 <free+0x60>
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
} else
bp->s.ptr = p->s.ptr;
382: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
385: 8b 50 04 mov 0x4(%eax),%edx
388: 8d 34 d0 lea (%eax,%edx,8),%esi
38b: 39 f1 cmp %esi,%ecx
38d: 74 28 je 3b7 <free+0x77>
p->s.size += bp->s.size;
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
38f: 89 08 mov %ecx,(%eax)
freep = p;
}
391: 5b pop %ebx
freep = p;
392: a3 c4 0b 00 00 mov %eax,0xbc4
}
397: 5e pop %esi
398: 5f pop %edi
399: 5d pop %ebp
39a: c3 ret
39b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
39f: 90 nop
bp->s.size += p->s.ptr->s.size;
3a0: 03 72 04 add 0x4(%edx),%esi
3a3: 89 73 fc mov %esi,-0x4(%ebx)
bp->s.ptr = p->s.ptr->s.ptr;
3a6: 8b 10 mov (%eax),%edx
3a8: 8b 12 mov (%edx),%edx
3aa: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
3ad: 8b 50 04 mov 0x4(%eax),%edx
3b0: 8d 34 d0 lea (%eax,%edx,8),%esi
3b3: 39 f1 cmp %esi,%ecx
3b5: 75 d8 jne 38f <free+0x4f>
p->s.size += bp->s.size;
3b7: 03 53 fc add -0x4(%ebx),%edx
freep = p;
3ba: a3 c4 0b 00 00 mov %eax,0xbc4
p->s.size += bp->s.size;
3bf: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
3c2: 8b 53 f8 mov -0x8(%ebx),%edx
3c5: 89 10 mov %edx,(%eax)
}
3c7: 5b pop %ebx
3c8: 5e pop %esi
3c9: 5f pop %edi
3ca: 5d pop %ebp
3cb: c3 ret
3cc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
000003d0 <malloc>:
return freep;
}
void*
malloc(uint nbytes)
{
3d0: f3 0f 1e fb endbr32
3d4: 55 push %ebp
3d5: 89 e5 mov %esp,%ebp
3d7: 57 push %edi
3d8: 56 push %esi
3d9: 53 push %ebx
3da: 83 ec 1c sub $0x1c,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
3dd: 8b 45 08 mov 0x8(%ebp),%eax
if((prevp = freep) == 0){
3e0: 8b 3d c4 0b 00 00 mov 0xbc4,%edi
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
3e6: 8d 70 07 lea 0x7(%eax),%esi
3e9: c1 ee 03 shr $0x3,%esi
3ec: 83 c6 01 add $0x1,%esi
if((prevp = freep) == 0){
3ef: 85 ff test %edi,%edi
3f1: 0f 84 a9 00 00 00 je 4a0 <malloc+0xd0>
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
3f7: 8b 07 mov (%edi),%eax
if(p->s.size >= nunits){
3f9: 8b 48 04 mov 0x4(%eax),%ecx
3fc: 39 f1 cmp %esi,%ecx
3fe: 73 6d jae 46d <malloc+0x9d>
400: 81 fe 00 10 00 00 cmp $0x1000,%esi
406: bb 00 10 00 00 mov $0x1000,%ebx
40b: 0f 43 de cmovae %esi,%ebx
p = sbrk(nu * sizeof(Header));
40e: 8d 0c dd 00 00 00 00 lea 0x0(,%ebx,8),%ecx
415: 89 4d e4 mov %ecx,-0x1c(%ebp)
418: eb 17 jmp 431 <malloc+0x61>
41a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
420: 8b 10 mov (%eax),%edx
if(p->s.size >= nunits){
422: 8b 4a 04 mov 0x4(%edx),%ecx
425: 39 f1 cmp %esi,%ecx
427: 73 4f jae 478 <malloc+0xa8>
429: 8b 3d c4 0b 00 00 mov 0xbc4,%edi
42f: 89 d0 mov %edx,%eax
p->s.size = nunits;
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
431: 39 c7 cmp %eax,%edi
433: 75 eb jne 420 <malloc+0x50>
p = sbrk(nu * sizeof(Header));
435: 83 ec 0c sub $0xc,%esp
438: ff 75 e4 pushl -0x1c(%ebp)
43b: e8 65 01 00 00 call 5a5 <sbrk>
if(p == (char*)-1)
440: 83 c4 10 add $0x10,%esp
443: 83 f8 ff cmp $0xffffffff,%eax
446: 74 1b je 463 <malloc+0x93>
hp->s.size = nu;
448: 89 58 04 mov %ebx,0x4(%eax)
free((void*)(hp + 1));
44b: 83 ec 0c sub $0xc,%esp
44e: 83 c0 08 add $0x8,%eax
451: 50 push %eax
452: e8 e9 fe ff ff call 340 <free>
return freep;
457: a1 c4 0b 00 00 mov 0xbc4,%eax
if((p = morecore(nunits)) == 0)
45c: 83 c4 10 add $0x10,%esp
45f: 85 c0 test %eax,%eax
461: 75 bd jne 420 <malloc+0x50>
return 0;
}
}
463: 8d 65 f4 lea -0xc(%ebp),%esp
return 0;
466: 31 c0 xor %eax,%eax
}
468: 5b pop %ebx
469: 5e pop %esi
46a: 5f pop %edi
46b: 5d pop %ebp
46c: c3 ret
if(p->s.size >= nunits){
46d: 89 c2 mov %eax,%edx
46f: 89 f8 mov %edi,%eax
471: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
if(p->s.size == nunits)
478: 39 ce cmp %ecx,%esi
47a: 74 54 je 4d0 <malloc+0x100>
p->s.size -= nunits;
47c: 29 f1 sub %esi,%ecx
47e: 89 4a 04 mov %ecx,0x4(%edx)
p += p->s.size;
481: 8d 14 ca lea (%edx,%ecx,8),%edx
p->s.size = nunits;
484: 89 72 04 mov %esi,0x4(%edx)
freep = prevp;
487: a3 c4 0b 00 00 mov %eax,0xbc4
}
48c: 8d 65 f4 lea -0xc(%ebp),%esp
return (void*)(p + 1);
48f: 8d 42 08 lea 0x8(%edx),%eax
}
492: 5b pop %ebx
493: 5e pop %esi
494: 5f pop %edi
495: 5d pop %ebp
496: c3 ret
497: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
49e: 66 90 xchg %ax,%ax
base.s.ptr = freep = prevp = &base;
4a0: c7 05 c4 0b 00 00 c8 movl $0xbc8,0xbc4
4a7: 0b 00 00
base.s.size = 0;
4aa: bf c8 0b 00 00 mov $0xbc8,%edi
base.s.ptr = freep = prevp = &base;
4af: c7 05 c8 0b 00 00 c8 movl $0xbc8,0xbc8
4b6: 0b 00 00
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
4b9: 89 f8 mov %edi,%eax
base.s.size = 0;
4bb: c7 05 cc 0b 00 00 00 movl $0x0,0xbcc
4c2: 00 00 00
if(p->s.size >= nunits){
4c5: e9 36 ff ff ff jmp 400 <malloc+0x30>
4ca: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
prevp->s.ptr = p->s.ptr;
4d0: 8b 0a mov (%edx),%ecx
4d2: 89 08 mov %ecx,(%eax)
4d4: eb b1 jmp 487 <malloc+0xb7>
4d6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
4dd: 8d 76 00 lea 0x0(%esi),%esi
000004e0 <thread_create>:
{
4e0: f3 0f 1e fb endbr32
4e4: 55 push %ebp
4e5: 89 e5 mov %esp,%ebp
4e7: 83 ec 14 sub $0x14,%esp
stack =malloc(4096); //pgsize
4ea: 68 00 10 00 00 push $0x1000
4ef: e8 dc fe ff ff call 3d0 <malloc>
return clone(start_routine,arg1,arg2,stack);
4f4: 50 push %eax
4f5: ff 75 10 pushl 0x10(%ebp)
4f8: ff 75 0c pushl 0xc(%ebp)
4fb: ff 75 08 pushl 0x8(%ebp)
4fe: e8 ba 00 00 00 call 5bd <clone>
}
503: c9 leave
504: c3 ret
00000505 <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
505: b8 01 00 00 00 mov $0x1,%eax
50a: cd 40 int $0x40
50c: c3 ret
0000050d <exit>:
SYSCALL(exit)
50d: b8 02 00 00 00 mov $0x2,%eax
512: cd 40 int $0x40
514: c3 ret
00000515 <wait>:
SYSCALL(wait)
515: b8 03 00 00 00 mov $0x3,%eax
51a: cd 40 int $0x40
51c: c3 ret
0000051d <pipe>:
SYSCALL(pipe)
51d: b8 04 00 00 00 mov $0x4,%eax
522: cd 40 int $0x40
524: c3 ret
00000525 <read>:
SYSCALL(read)
525: b8 05 00 00 00 mov $0x5,%eax
52a: cd 40 int $0x40
52c: c3 ret
0000052d <write>:
SYSCALL(write)
52d: b8 10 00 00 00 mov $0x10,%eax
532: cd 40 int $0x40
534: c3 ret
00000535 <close>:
SYSCALL(close)
535: b8 15 00 00 00 mov $0x15,%eax
53a: cd 40 int $0x40
53c: c3 ret
0000053d <kill>:
SYSCALL(kill)
53d: b8 06 00 00 00 mov $0x6,%eax
542: cd 40 int $0x40
544: c3 ret
00000545 <exec>:
SYSCALL(exec)
545: b8 07 00 00 00 mov $0x7,%eax
54a: cd 40 int $0x40
54c: c3 ret
0000054d <open>:
SYSCALL(open)
54d: b8 0f 00 00 00 mov $0xf,%eax
552: cd 40 int $0x40
554: c3 ret
00000555 <mknod>:
SYSCALL(mknod)
555: b8 11 00 00 00 mov $0x11,%eax
55a: cd 40 int $0x40
55c: c3 ret
0000055d <unlink>:
SYSCALL(unlink)
55d: b8 12 00 00 00 mov $0x12,%eax
562: cd 40 int $0x40
564: c3 ret
00000565 <fstat>:
SYSCALL(fstat)
565: b8 08 00 00 00 mov $0x8,%eax
56a: cd 40 int $0x40
56c: c3 ret
0000056d <link>:
SYSCALL(link)
56d: b8 13 00 00 00 mov $0x13,%eax
572: cd 40 int $0x40
574: c3 ret
00000575 <mkdir>:
SYSCALL(mkdir)
575: b8 14 00 00 00 mov $0x14,%eax
57a: cd 40 int $0x40
57c: c3 ret
0000057d <chdir>:
SYSCALL(chdir)
57d: b8 09 00 00 00 mov $0x9,%eax
582: cd 40 int $0x40
584: c3 ret
00000585 <dup>:
SYSCALL(dup)
585: b8 0a 00 00 00 mov $0xa,%eax
58a: cd 40 int $0x40
58c: c3 ret
0000058d <getpid>:
SYSCALL(getpid)
58d: b8 0b 00 00 00 mov $0xb,%eax
592: cd 40 int $0x40
594: c3 ret
00000595 <getyear>:
SYSCALL(getyear)
595: b8 16 00 00 00 mov $0x16,%eax
59a: cd 40 int $0x40
59c: c3 ret
0000059d <getreadcount>:
SYSCALL(getreadcount)
59d: b8 17 00 00 00 mov $0x17,%eax
5a2: cd 40 int $0x40
5a4: c3 ret
000005a5 <sbrk>:
SYSCALL(sbrk)
5a5: b8 0c 00 00 00 mov $0xc,%eax
5aa: cd 40 int $0x40
5ac: c3 ret
000005ad <sleep>:
SYSCALL(sleep)
5ad: b8 0d 00 00 00 mov $0xd,%eax
5b2: cd 40 int $0x40
5b4: c3 ret
000005b5 <uptime>:
SYSCALL(uptime)
5b5: b8 0e 00 00 00 mov $0xe,%eax
5ba: cd 40 int $0x40
5bc: c3 ret
000005bd <clone>:
SYSCALL(clone)
5bd: b8 18 00 00 00 mov $0x18,%eax
5c2: cd 40 int $0x40
5c4: c3 ret
000005c5 <join>:
SYSCALL(join)
5c5: b8 19 00 00 00 mov $0x19,%eax
5ca: cd 40 int $0x40
5cc: c3 ret
5cd: 66 90 xchg %ax,%ax
5cf: 90 nop
000005d0 <printint>:
write(fd, &c, 1);
}
static void
printint(int fd, int xx, int base, int sgn)
{
5d0: 55 push %ebp
5d1: 89 e5 mov %esp,%ebp
5d3: 57 push %edi
5d4: 56 push %esi
5d5: 53 push %ebx
5d6: 83 ec 3c sub $0x3c,%esp
5d9: 89 4d c4 mov %ecx,-0x3c(%ebp)
uint x;
neg = 0;
if(sgn && xx < 0){
neg = 1;
x = -xx;
5dc: 89 d1 mov %edx,%ecx
{
5de: 89 45 b8 mov %eax,-0x48(%ebp)
if(sgn && xx < 0){
5e1: 85 d2 test %edx,%edx
5e3: 0f 89 7f 00 00 00 jns 668 <printint+0x98>
5e9: f6 45 08 01 testb $0x1,0x8(%ebp)
5ed: 74 79 je 668 <printint+0x98>
neg = 1;
5ef: c7 45 bc 01 00 00 00 movl $0x1,-0x44(%ebp)
x = -xx;
5f6: f7 d9 neg %ecx
} else {
x = xx;
}
i = 0;
5f8: 31 db xor %ebx,%ebx
5fa: 8d 75 d7 lea -0x29(%ebp),%esi
5fd: 8d 76 00 lea 0x0(%esi),%esi
do{
buf[i++] = digits[x % base];
600: 89 c8 mov %ecx,%eax
602: 31 d2 xor %edx,%edx
604: 89 cf mov %ecx,%edi
606: f7 75 c4 divl -0x3c(%ebp)
609: 0f b6 92 78 08 00 00 movzbl 0x878(%edx),%edx
610: 89 45 c0 mov %eax,-0x40(%ebp)
613: 89 d8 mov %ebx,%eax
615: 8d 5b 01 lea 0x1(%ebx),%ebx
}while((x /= base) != 0);
618: 8b 4d c0 mov -0x40(%ebp),%ecx
buf[i++] = digits[x % base];
61b: 88 14 1e mov %dl,(%esi,%ebx,1)
}while((x /= base) != 0);
61e: 39 7d c4 cmp %edi,-0x3c(%ebp)
621: 76 dd jbe 600 <printint+0x30>
if(neg)
623: 8b 4d bc mov -0x44(%ebp),%ecx
626: 85 c9 test %ecx,%ecx
628: 74 0c je 636 <printint+0x66>
buf[i++] = '-';
62a: c6 44 1d d8 2d movb $0x2d,-0x28(%ebp,%ebx,1)
buf[i++] = digits[x % base];
62f: 89 d8 mov %ebx,%eax
buf[i++] = '-';
631: ba 2d 00 00 00 mov $0x2d,%edx
while(--i >= 0)
636: 8b 7d b8 mov -0x48(%ebp),%edi
639: 8d 5c 05 d7 lea -0x29(%ebp,%eax,1),%ebx
63d: eb 07 jmp 646 <printint+0x76>
63f: 90 nop
640: 0f b6 13 movzbl (%ebx),%edx
643: 83 eb 01 sub $0x1,%ebx
write(fd, &c, 1);
646: 83 ec 04 sub $0x4,%esp
649: 88 55 d7 mov %dl,-0x29(%ebp)
64c: 6a 01 push $0x1
64e: 56 push %esi
64f: 57 push %edi
650: e8 d8 fe ff ff call 52d <write>
while(--i >= 0)
655: 83 c4 10 add $0x10,%esp
658: 39 de cmp %ebx,%esi
65a: 75 e4 jne 640 <printint+0x70>
putc(fd, buf[i]);
}
65c: 8d 65 f4 lea -0xc(%ebp),%esp
65f: 5b pop %ebx
660: 5e pop %esi
661: 5f pop %edi
662: 5d pop %ebp
663: c3 ret
664: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
neg = 0;
668: c7 45 bc 00 00 00 00 movl $0x0,-0x44(%ebp)
66f: eb 87 jmp 5f8 <printint+0x28>
671: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
678: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
67f: 90 nop
00000680 <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, const char *fmt, ...)
{
680: f3 0f 1e fb endbr32
684: 55 push %ebp
685: 89 e5 mov %esp,%ebp
687: 57 push %edi
688: 56 push %esi
689: 53 push %ebx
68a: 83 ec 2c sub $0x2c,%esp
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
68d: 8b 75 0c mov 0xc(%ebp),%esi
690: 0f b6 1e movzbl (%esi),%ebx
693: 84 db test %bl,%bl
695: 0f 84 b4 00 00 00 je 74f <printf+0xcf>
ap = (uint*)(void*)&fmt + 1;
69b: 8d 45 10 lea 0x10(%ebp),%eax
69e: 83 c6 01 add $0x1,%esi
write(fd, &c, 1);
6a1: 8d 7d e7 lea -0x19(%ebp),%edi
state = 0;
6a4: 31 d2 xor %edx,%edx
ap = (uint*)(void*)&fmt + 1;
6a6: 89 45 d0 mov %eax,-0x30(%ebp)
6a9: eb 33 jmp 6de <printf+0x5e>
6ab: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
6af: 90 nop
6b0: 89 55 d4 mov %edx,-0x2c(%ebp)
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
state = '%';
6b3: ba 25 00 00 00 mov $0x25,%edx
if(c == '%'){
6b8: 83 f8 25 cmp $0x25,%eax
6bb: 74 17 je 6d4 <printf+0x54>
write(fd, &c, 1);
6bd: 83 ec 04 sub $0x4,%esp
6c0: 88 5d e7 mov %bl,-0x19(%ebp)
6c3: 6a 01 push $0x1
6c5: 57 push %edi
6c6: ff 75 08 pushl 0x8(%ebp)
6c9: e8 5f fe ff ff call 52d <write>
6ce: 8b 55 d4 mov -0x2c(%ebp),%edx
} else {
putc(fd, c);
6d1: 83 c4 10 add $0x10,%esp
for(i = 0; fmt[i]; i++){
6d4: 0f b6 1e movzbl (%esi),%ebx
6d7: 83 c6 01 add $0x1,%esi
6da: 84 db test %bl,%bl
6dc: 74 71 je 74f <printf+0xcf>
c = fmt[i] & 0xff;
6de: 0f be cb movsbl %bl,%ecx
6e1: 0f b6 c3 movzbl %bl,%eax
if(state == 0){
6e4: 85 d2 test %edx,%edx
6e6: 74 c8 je 6b0 <printf+0x30>
}
} else if(state == '%'){
6e8: 83 fa 25 cmp $0x25,%edx
6eb: 75 e7 jne 6d4 <printf+0x54>
if(c == 'd'){
6ed: 83 f8 64 cmp $0x64,%eax
6f0: 0f 84 9a 00 00 00 je 790 <printf+0x110>
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
6f6: 81 e1 f7 00 00 00 and $0xf7,%ecx
6fc: 83 f9 70 cmp $0x70,%ecx
6ff: 74 5f je 760 <printf+0xe0>
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
701: 83 f8 73 cmp $0x73,%eax
704: 0f 84 d6 00 00 00 je 7e0 <printf+0x160>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
70a: 83 f8 63 cmp $0x63,%eax
70d: 0f 84 8d 00 00 00 je 7a0 <printf+0x120>
putc(fd, *ap);
ap++;
} else if(c == '%'){
713: 83 f8 25 cmp $0x25,%eax
716: 0f 84 b4 00 00 00 je 7d0 <printf+0x150>
write(fd, &c, 1);
71c: 83 ec 04 sub $0x4,%esp
71f: c6 45 e7 25 movb $0x25,-0x19(%ebp)
723: 6a 01 push $0x1
725: 57 push %edi
726: ff 75 08 pushl 0x8(%ebp)
729: e8 ff fd ff ff call 52d <write>
putc(fd, c);
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
72e: 88 5d e7 mov %bl,-0x19(%ebp)
write(fd, &c, 1);
731: 83 c4 0c add $0xc,%esp
734: 6a 01 push $0x1
736: 83 c6 01 add $0x1,%esi
739: 57 push %edi
73a: ff 75 08 pushl 0x8(%ebp)
73d: e8 eb fd ff ff call 52d <write>
for(i = 0; fmt[i]; i++){
742: 0f b6 5e ff movzbl -0x1(%esi),%ebx
putc(fd, c);
746: 83 c4 10 add $0x10,%esp
}
state = 0;
749: 31 d2 xor %edx,%edx
for(i = 0; fmt[i]; i++){
74b: 84 db test %bl,%bl
74d: 75 8f jne 6de <printf+0x5e>
}
}
}
74f: 8d 65 f4 lea -0xc(%ebp),%esp
752: 5b pop %ebx
753: 5e pop %esi
754: 5f pop %edi
755: 5d pop %ebp
756: c3 ret
757: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
75e: 66 90 xchg %ax,%ax
printint(fd, *ap, 16, 0);
760: 83 ec 0c sub $0xc,%esp
763: b9 10 00 00 00 mov $0x10,%ecx
768: 6a 00 push $0x0
76a: 8b 5d d0 mov -0x30(%ebp),%ebx
76d: 8b 45 08 mov 0x8(%ebp),%eax
770: 8b 13 mov (%ebx),%edx
772: e8 59 fe ff ff call 5d0 <printint>
ap++;
777: 89 d8 mov %ebx,%eax
779: 83 c4 10 add $0x10,%esp
state = 0;
77c: 31 d2 xor %edx,%edx
ap++;
77e: 83 c0 04 add $0x4,%eax
781: 89 45 d0 mov %eax,-0x30(%ebp)
784: e9 4b ff ff ff jmp 6d4 <printf+0x54>
789: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
printint(fd, *ap, 10, 1);
790: 83 ec 0c sub $0xc,%esp
793: b9 0a 00 00 00 mov $0xa,%ecx
798: 6a 01 push $0x1
79a: eb ce jmp 76a <printf+0xea>
79c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
putc(fd, *ap);
7a0: 8b 5d d0 mov -0x30(%ebp),%ebx
write(fd, &c, 1);
7a3: 83 ec 04 sub $0x4,%esp
putc(fd, *ap);
7a6: 8b 03 mov (%ebx),%eax
write(fd, &c, 1);
7a8: 6a 01 push $0x1
ap++;
7aa: 83 c3 04 add $0x4,%ebx
write(fd, &c, 1);
7ad: 57 push %edi
7ae: ff 75 08 pushl 0x8(%ebp)
putc(fd, *ap);
7b1: 88 45 e7 mov %al,-0x19(%ebp)
write(fd, &c, 1);
7b4: e8 74 fd ff ff call 52d <write>
ap++;
7b9: 89 5d d0 mov %ebx,-0x30(%ebp)
7bc: 83 c4 10 add $0x10,%esp
state = 0;
7bf: 31 d2 xor %edx,%edx
7c1: e9 0e ff ff ff jmp 6d4 <printf+0x54>
7c6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
7cd: 8d 76 00 lea 0x0(%esi),%esi
putc(fd, c);
7d0: 88 5d e7 mov %bl,-0x19(%ebp)
write(fd, &c, 1);
7d3: 83 ec 04 sub $0x4,%esp
7d6: e9 59 ff ff ff jmp 734 <printf+0xb4>
7db: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
7df: 90 nop
s = (char*)*ap;
7e0: 8b 45 d0 mov -0x30(%ebp),%eax
7e3: 8b 18 mov (%eax),%ebx
ap++;
7e5: 83 c0 04 add $0x4,%eax
7e8: 89 45 d0 mov %eax,-0x30(%ebp)
if(s == 0)
7eb: 85 db test %ebx,%ebx
7ed: 74 17 je 806 <printf+0x186>
while(*s != 0){
7ef: 0f b6 03 movzbl (%ebx),%eax
state = 0;
7f2: 31 d2 xor %edx,%edx
while(*s != 0){
7f4: 84 c0 test %al,%al
7f6: 0f 84 d8 fe ff ff je 6d4 <printf+0x54>
7fc: 89 75 d4 mov %esi,-0x2c(%ebp)
7ff: 89 de mov %ebx,%esi
801: 8b 5d 08 mov 0x8(%ebp),%ebx
804: eb 1a jmp 820 <printf+0x1a0>
s = "(null)";
806: bb 6f 08 00 00 mov $0x86f,%ebx
while(*s != 0){
80b: 89 75 d4 mov %esi,-0x2c(%ebp)
80e: b8 28 00 00 00 mov $0x28,%eax
813: 89 de mov %ebx,%esi
815: 8b 5d 08 mov 0x8(%ebp),%ebx
818: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
81f: 90 nop
write(fd, &c, 1);
820: 83 ec 04 sub $0x4,%esp
s++;
823: 83 c6 01 add $0x1,%esi
826: 88 45 e7 mov %al,-0x19(%ebp)
write(fd, &c, 1);
829: 6a 01 push $0x1
82b: 57 push %edi
82c: 53 push %ebx
82d: e8 fb fc ff ff call 52d <write>
while(*s != 0){
832: 0f b6 06 movzbl (%esi),%eax
835: 83 c4 10 add $0x10,%esp
838: 84 c0 test %al,%al
83a: 75 e4 jne 820 <printf+0x1a0>
83c: 8b 75 d4 mov -0x2c(%ebp),%esi
state = 0;
83f: 31 d2 xor %edx,%edx
841: e9 8e fe ff ff jmp 6d4 <printf+0x54>
| 33.71789 | 60 | 0.416253 | [
"MIT-0"
] | shahendahamdy/xv6-threads | ln.asm | 44,103 | Assembly |
; lzo1c_s1.asm -- lzo1c_decompress_asm
;
; This file is part of the LZO real-time data compression library.
;
; Copyright (C) 2011 Markus Franz Xaver Johannes Oberhumer
; Copyright (C) 2010 Markus Franz Xaver Johannes Oberhumer
; Copyright (C) 2009 Markus Franz Xaver Johannes Oberhumer
; Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer
; Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer
; Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer
; Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer
; Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
; Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
; Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
; Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
; Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
; Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
; Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
; Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
; Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
; All Rights Reserved.
;
; The LZO library is free software; you can redistribute it and/or
; modify it under the terms of the GNU General Public License as
; published by the Free Software Foundation; either version 2 of
; the License, or (at your option) any later version.
;
; The LZO library is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with the LZO library; see the file COPYING.
; If not, write to the Free Software Foundation, Inc.,
; 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
;
; Markus F.X.J. Oberhumer
; <markus@oberhumer.com>
; http://www.oberhumer.com/opensource/lzo/
;
; /***** DO NOT EDIT - GENERATED AUTOMATICALLY *****/
include asminit.def
public _lzo1c_decompress_asm
_lzo1c_decompress_asm:
db 85,87,86,83,81,82,131,236,12,252,139,116,36,40,139,124
db 36,48,189,3,0,0,0,144,49,192,138,6,70,60,32,115
db 15,8,192,116,51,137,193,243,164,138,6,70,60,32,114,72
db 60,64,114,93,137,193,36,31,141,87,255,193,233,5,41,194
db 138,6,70,193,224,5,41,194,65,135,242,243,164,137,214,235
db 199,141,180,38,0,0,0,0,138,6,70,141,72,32,60,248
db 114,197,185,24,1,0,0,44,248,116,6,145,48,192,211,224
db 145,243,164,235,163,141,118,0,141,87,255,41,194,138,6,70
db 193,224,5,41,194,135,242,164,164,164,137,214,164,49,192,235
db 152,36,31,137,193,117,19,177,31,138,6,70,8,192,117,8
db 129,193,255,0,0,0,235,241,1,193,138,6,70,137,195,36
db 63,137,250,41,194,138,6,70,193,224,6,41,194,57,250,116
db 27,135,214,141,73,3,243,164,137,214,49,192,193,235,6,137
db 217,15,133,80,255,255,255,233,60,255,255,255,131,249,1,15
db 149,192,139,84,36,40,3,84,36,44,57,214,119,38,114,29
db 43,124,36,48,139,84,36,52,137,58,247,216,131,196,12,90
db 89,91,94,95,93,195,184,1,0,0,0,235,227,184,8,0
db 0,0,235,220,184,4,0,0,0,235,213,144,141,116,38,0
end
| 46.298507 | 69 | 0.741457 | [
"MIT"
] | Infoss/conf-profile-4-android | ConfProfile/jni/lzo/asm/i386/src_masm/lzo1c_s1.asm | 3,102 | Assembly |
.size 8000
.text@100
jp lbegin
.data@143
80
.text@150
lbegin:
xor a, a
ldff(26), a
ld a, 80
ldff(26), a
ld a, 77
ldff(24), a
ld a, 11
ldff(25), a
ld a, 80
ldff(11), a
ld a, 80
ldff(12), a
ld a, c0
ldff(13), a
ld a, 87
ldff(14), a
ld b, 81
lwaitpos:
dec b
jrnz lwaitpos
ld a, 80
lmodulate:
xor a, 40
ldff(12), a
ld b, a
ld a, 80
ldff(14), a
ld a, b
ld b, 20
lwaitperiod:
dec b
jrnz lwaitperiod
jr lmodulate
| 9.822222 | 17 | 0.595023 | [
"MIT"
] | Manurocker95/GiovanniEmulator | GIOVANNI/gambatte/test/hwtests/sound/ch1_duty2_pattern_pos8_dmg08_cgb04c_outaudio1.asm | 442 | Assembly |
; A212565: Number of (w,x,y,z) with all terms in {1,...,n} and w+x>=2y+2z.
; 0,0,1,8,28,74,159,304,528,860,1325,1960,2796,3878,5243,6944,9024,11544,14553,18120,22300,27170,32791,39248,46608,54964,64389,74984,86828,100030,114675,130880,148736,168368,189873,213384,239004,266874,297103,329840,365200,403340,444381,488488,535788,586454,640619,698464,760128,825800,895625,969800,1048476,1131858,1220103,1313424,1411984,1516004,1625653,1741160,1862700,1990510,2124771,2265728,2413568,2568544,2730849,2900744,3078428,3264170,3458175,3660720,3872016,4092348,4321933,4561064,4809964,5068934,5338203,5618080,5908800,6210680,6523961,6848968,7185948,7535234,7897079,8271824,8659728,9061140,9476325,9905640,10349356,10807838,11281363,11770304,12274944,12795664,13332753,13886600
mov $3,$0
mov $5,$0
lpb $3
mov $0,$5
mov $2,0
sub $3,1
sub $0,$3
sub $0,1
mov $4,$0
mul $4,$0
div $4,4
lpb $0
add $4,$0
sub $0,1
add $2,$4
lpe
add $1,$2
lpe
mov $0,$1
| 42.130435 | 691 | 0.74613 | [
"Apache-2.0"
] | ckrause/cm | programs/oeis/212/A212565.asm | 969 | Assembly |
SECTION "Interrupt vectors", ROM0[$0040]
; VBlank
VBlank_int::
push af
push bc
call VBlankHandler
pop bc
pop af
reti
; STAT
STAT_int::
push af
ld a, [rSTAT]
push hl
jp STATHandler
nop
; Timer
Timer_int::
reti
; Fitting these two functions in the spare bytes for MAXIMUM DATA COMPRESSION 8|
; Switches to RAM bank a
SwitchRAMBanks::
ldh [hCurRAMBank], a
ld [rSVBK], a
; In case you need to point to a `ret`
DoNothing::
ret
; Do you need a pointer to $00, be it byte or word?
; WE GOT YOU COVERED RIGHT HERE!!1
NullWord::
NullByte::
dw 0
; Serial
Serial_int::
reti
; Delay bc frames
DelayBCFrames::
rst waitVBlank
dec bc
ld a, b
or c
jr nz, DelayBCFrames
ret
; Joypad
Joypad_int::
reti ; Will never be used, I think
; Thus, no extra space behind it, so we can fit 7 more function bytes :)
| 14.866667 | 81 | 0.646861 | [
"Apache-2.0"
] | ISSOtm/Aevilia-GB | home/interrupts.asm | 892 | Assembly |
ADDR EQU #6000 ;START OF CODE
TABL EQU #FF00
ORG ADDR
LD HL,TABL
LD B,L
FAD_LP LD D,L
LD A,D
AND 1+2+4
OR A
JR Z,NODINK
DEC D
NODINK LD A,D
AND 8+16+32
OR A
JR Z,NODPAP
LD A,D
SUB 8
LD D,A
NODPAP LD (HL),D
INC L
DJNZ FAD_LP
EI
LD C,8
FAD_LL HALT
HALT
HALT
HALT
LD (STEK),SP
LD SP,#5800
LD B,#C0
LD H,TABL/#100
FAD_L1 POP DE
LD L,E
LD E,(HL)
LD L,D
LD D,(HL)
PUSH DE
POP DE
POP DE
LD L,E
LD E,(HL)
LD L,D
LD D,(HL)
PUSH DE
POP DE
DJNZ FAD_L1
LD SP,#3131
STEK EQU $-2
DEC C
JR NZ,FAD_LL
RET
ENDOBJ
DISPLAY "SCREEN FADE TO 0 SUB-PROG (STEK VER.) (C)ALX"
DISPLAY "Org_addr=",ADDR
DISPLAY "Lenght=",ENDOBJ-ADDR
DISPLAY "Tabl_addr:",TABL,"...",TABL+#100
| 18.017241 | 62 | 0.42488 | [
"MIT"
] | alexanderbazhenoff/zx-spectrum-various | loaders_patches_etc/screen_fade0s.asm | 1,045 | Assembly |
; Assembly for arraystr-bytecode.bas
; compiled with mcbasic
; Equates for MC-10 MICROCOLOR BASIC 1.0
;
; Direct page equates
DP_LNUM .equ $E2 ; current line in BASIC
DP_TABW .equ $E4 ; current tab width on console
DP_LPOS .equ $E6 ; current line position on console
DP_LWID .equ $E7 ; current line width of console
;
; Memory equates
M_KBUF .equ $4231 ; keystrobe buffer (8 bytes)
M_PMSK .equ $423C ; pixel mask for SET, RESET and POINT
M_IKEY .equ $427F ; key code for INKEY$
M_CRSR .equ $4280 ; cursor location
M_LBUF .equ $42B2 ; line input buffer (130 chars)
M_MSTR .equ $4334 ; buffer for small string moves
M_CODE .equ $4346 ; start of program space
;
; ROM equates
R_BKMSG .equ $E1C1 ; 'BREAK' string location
R_ERROR .equ $E238 ; generate error and restore direct mode
R_BREAK .equ $E266 ; generate break and restore direct mode
R_RESET .equ $E3EE ; setup stack and disable CONT
R_SPACE .equ $E7B9 ; emit " " to console
R_QUEST .equ $E7BC ; emit "?" to console
R_REDO .equ $E7C1 ; emit "?REDO" to console
R_EXTRA .equ $E8AB ; emit "?EXTRA IGNORED" to console
R_DMODE .equ $F7AA ; display OK prompt and restore direct mode
R_KPOLL .equ $F879 ; if key is down, do KEYIN, else set Z CCR flag
R_KEYIN .equ $F883 ; poll key for key-down transition set Z otherwise
R_PUTC .equ $F9C9 ; write ACCA to console
R_MKTAB .equ $FA7B ; setup tabs for console
R_GETLN .equ $FAA4 ; get line, returning with X pointing to M_BUF-1
R_SETPX .equ $FB44 ; write pixel character to X
R_CLRPX .equ $FB59 ; clear pixel character in X
R_MSKPX .equ $FB7C ; get pixel screen location X and mask in R_PMSK
R_CLSN .equ $FBC4 ; clear screen with color code in ACCB
R_CLS .equ $FBD4 ; clear screen with space character
R_SOUND .equ $FFAB ; play sound with pitch in ACCA and duration in ACCB
R_MCXID .equ $FFDA ; ID location for MCX BASIC
; direct page registers
.org $80
strtcnt .block 1
strbuf .block 2
strend .block 2
strfree .block 2
strstop .block 2
dataptr .block 2
inptptr .block 2
redoptr .block 2
letptr .block 2
.org $a3
r1 .block 5
r2 .block 5
rend
rvseed .block 2
curinst .block 2
nxtinst .block 2
tmp1 .block 2
tmp2 .block 2
tmp3 .block 2
tmp4 .block 2
tmp5 .block 2
argv .block 10
.org M_CODE
.module mdmain
ldx #program
stx nxtinst
mainloop
ldx nxtinst
stx curinst
ldab ,x
ldx #catalog
abx
abx
ldx ,x
jsr 0,x
bra mainloop
program
.byte bytecode_progbegin
.byte bytecode_clear
LINE_0
; DIM C$(6)
.byte bytecode_ld_ir1_pb
.byte 6
.byte bytecode_arrdim1_ir1_sx
.byte bytecode_STRARR_C
; CLS
.byte bytecode_cls
LINE_5
; C$(0)=" "
.byte bytecode_ld_ir1_pb
.byte 0
.byte bytecode_arrref1_ir1_sx
.byte bytecode_STRARR_C
.byte bytecode_ld_sr1_ss
.text 1, " "
.byte bytecode_ld_sp_sr1
LINE_10
; C$(1)="A"
.byte bytecode_ld_ir1_pb
.byte 1
.byte bytecode_arrref1_ir1_sx
.byte bytecode_STRARR_C
.byte bytecode_ld_sr1_ss
.text 1, "A"
.byte bytecode_ld_sp_sr1
LINE_20
; C$(2)="B"
.byte bytecode_ld_ir1_pb
.byte 2
.byte bytecode_arrref1_ir1_sx
.byte bytecode_STRARR_C
.byte bytecode_ld_sr1_ss
.text 1, "B"
.byte bytecode_ld_sp_sr1
LINE_30
; C$(3)="C"
.byte bytecode_ld_ir1_pb
.byte 3
.byte bytecode_arrref1_ir1_sx
.byte bytecode_STRARR_C
.byte bytecode_ld_sr1_ss
.text 1, "C"
.byte bytecode_ld_sp_sr1
LINE_40
; C$(4)="D"
.byte bytecode_ld_ir1_pb
.byte 4
.byte bytecode_arrref1_ir1_sx
.byte bytecode_STRARR_C
.byte bytecode_ld_sr1_ss
.text 1, "D"
.byte bytecode_ld_sp_sr1
LINE_50
; C$(5)="E"
.byte bytecode_ld_ir1_pb
.byte 5
.byte bytecode_arrref1_ir1_sx
.byte bytecode_STRARR_C
.byte bytecode_ld_sr1_ss
.text 1, "E"
.byte bytecode_ld_sp_sr1
LINE_60
; C$(6)="F"
.byte bytecode_ld_ir1_pb
.byte 6
.byte bytecode_arrref1_ir1_sx
.byte bytecode_STRARR_C
.byte bytecode_ld_sr1_ss
.text 1, "F"
.byte bytecode_ld_sp_sr1
LINE_100
; D$=C$(1)
.byte bytecode_ld_ir1_pb
.byte 1
.byte bytecode_arrval1_ir1_sx
.byte bytecode_STRARR_C
.byte bytecode_ld_sx_sr1
.byte bytecode_STRVAR_D
; E$=C$(2)
.byte bytecode_ld_ir1_pb
.byte 2
.byte bytecode_arrval1_ir1_sx
.byte bytecode_STRARR_C
.byte bytecode_ld_sx_sr1
.byte bytecode_STRVAR_E
; F$=C$(3)
.byte bytecode_ld_ir1_pb
.byte 3
.byte bytecode_arrval1_ir1_sx
.byte bytecode_STRARR_C
.byte bytecode_ld_sx_sr1
.byte bytecode_STRVAR_F
LINE_111
; WHEN INKEY$="" GOTO 111
.byte bytecode_inkey_sr1
.byte bytecode_ldeq_ir1_sr1_ss
.text 0, ""
.byte bytecode_jmpne_ir1_ix
.word LINE_111
LINE_112
; D$=D$+C$(1)
.byte bytecode_strinit_sr1_sx
.byte bytecode_STRVAR_D
.byte bytecode_ld_ir2_pb
.byte 1
.byte bytecode_arrval1_ir2_sx
.byte bytecode_STRARR_C
.byte bytecode_strcat_sr1_sr1_sr2
.byte bytecode_ld_sx_sr1
.byte bytecode_STRVAR_D
LINE_113
; WHEN INKEY$="" GOTO 113
.byte bytecode_inkey_sr1
.byte bytecode_ldeq_ir1_sr1_ss
.text 0, ""
.byte bytecode_jmpne_ir1_ix
.word LINE_113
LINE_114
; E$=E$+C$(2)
.byte bytecode_strinit_sr1_sx
.byte bytecode_STRVAR_E
.byte bytecode_ld_ir2_pb
.byte 2
.byte bytecode_arrval1_ir2_sx
.byte bytecode_STRARR_C
.byte bytecode_strcat_sr1_sr1_sr2
.byte bytecode_ld_sx_sr1
.byte bytecode_STRVAR_E
LINE_115
; WHEN INKEY$="" GOTO 115
.byte bytecode_inkey_sr1
.byte bytecode_ldeq_ir1_sr1_ss
.text 0, ""
.byte bytecode_jmpne_ir1_ix
.word LINE_115
LINE_116
; F$=F$+C$(3)
.byte bytecode_strinit_sr1_sx
.byte bytecode_STRVAR_F
.byte bytecode_ld_ir2_pb
.byte 3
.byte bytecode_arrval1_ir2_sx
.byte bytecode_STRARR_C
.byte bytecode_strcat_sr1_sr1_sr2
.byte bytecode_ld_sx_sr1
.byte bytecode_STRVAR_F
LINE_117
; WHEN INKEY$="" GOTO 117
.byte bytecode_inkey_sr1
.byte bytecode_ldeq_ir1_sr1_ss
.text 0, ""
.byte bytecode_jmpne_ir1_ix
.word LINE_117
LINE_122
; D$=D$+C$(1)
.byte bytecode_strinit_sr1_sx
.byte bytecode_STRVAR_D
.byte bytecode_ld_ir2_pb
.byte 1
.byte bytecode_arrval1_ir2_sx
.byte bytecode_STRARR_C
.byte bytecode_strcat_sr1_sr1_sr2
.byte bytecode_ld_sx_sr1
.byte bytecode_STRVAR_D
LINE_123
; WHEN INKEY$="" GOTO 123
.byte bytecode_inkey_sr1
.byte bytecode_ldeq_ir1_sr1_ss
.text 0, ""
.byte bytecode_jmpne_ir1_ix
.word LINE_123
LINE_124
; E$=E$+C$(2)
.byte bytecode_strinit_sr1_sx
.byte bytecode_STRVAR_E
.byte bytecode_ld_ir2_pb
.byte 2
.byte bytecode_arrval1_ir2_sx
.byte bytecode_STRARR_C
.byte bytecode_strcat_sr1_sr1_sr2
.byte bytecode_ld_sx_sr1
.byte bytecode_STRVAR_E
LINE_125
; WHEN INKEY$="" GOTO 125
.byte bytecode_inkey_sr1
.byte bytecode_ldeq_ir1_sr1_ss
.text 0, ""
.byte bytecode_jmpne_ir1_ix
.word LINE_125
LINE_126
; F$=F$+C$(3)
.byte bytecode_strinit_sr1_sx
.byte bytecode_STRVAR_F
.byte bytecode_ld_ir2_pb
.byte 3
.byte bytecode_arrval1_ir2_sx
.byte bytecode_STRARR_C
.byte bytecode_strcat_sr1_sr1_sr2
.byte bytecode_ld_sx_sr1
.byte bytecode_STRVAR_F
LINE_127
; WHEN INKEY$="" GOTO 127
.byte bytecode_inkey_sr1
.byte bytecode_ldeq_ir1_sr1_ss
.text 0, ""
.byte bytecode_jmpne_ir1_ix
.word LINE_127
LLAST
; END
.byte bytecode_progend
; Library Catalog
bytecode_arrdim1_ir1_sx .equ 0
bytecode_arrref1_ir1_sx .equ 1
bytecode_arrval1_ir1_sx .equ 2
bytecode_arrval1_ir2_sx .equ 3
bytecode_clear .equ 4
bytecode_cls .equ 5
bytecode_inkey_sr1 .equ 6
bytecode_jmpne_ir1_ix .equ 7
bytecode_ld_ir1_pb .equ 8
bytecode_ld_ir2_pb .equ 9
bytecode_ld_sp_sr1 .equ 10
bytecode_ld_sr1_ss .equ 11
bytecode_ld_sx_sr1 .equ 12
bytecode_ldeq_ir1_sr1_ss .equ 13
bytecode_progbegin .equ 14
bytecode_progend .equ 15
bytecode_strcat_sr1_sr1_sr2 .equ 16
bytecode_strinit_sr1_sx .equ 17
catalog
.word arrdim1_ir1_sx
.word arrref1_ir1_sx
.word arrval1_ir1_sx
.word arrval1_ir2_sx
.word clear
.word cls
.word inkey_sr1
.word jmpne_ir1_ix
.word ld_ir1_pb
.word ld_ir2_pb
.word ld_sp_sr1
.word ld_sr1_ss
.word ld_sx_sr1
.word ldeq_ir1_sr1_ss
.word progbegin
.word progend
.word strcat_sr1_sr1_sr2
.word strinit_sr1_sx
.module mdalloc
; alloc D bytes in array memory.
; then relink strings.
alloc
std tmp1
ldx strfree
addd strfree
std strfree
ldd strend
addd tmp1
std strend
sts tmp2
subd tmp2
blo _ok
ldab #OM_ERROR
jmp error
_ok
lds strfree
des
_again
dex
dex
ldd ,x
pshb
psha
cpx strbuf
bhi _again
lds tmp2
ldx strbuf
ldd strbuf
addd tmp1
std strbuf
clra
_nxtz
staa ,x
inx
cpx strbuf
blo _nxtz
ldx strbuf
; relink permanent strings
; ENTRY: X points to offending link word in strbuf
; EXIT: X points to strend
strlink
cpx strend
bhs _rts
stx tmp1
ldd tmp1
addd #2
ldx ,x
std 1,x
ldab 0,x
ldx 1,x
abx
bra strlink
_rts
rts
.module mdbcode
noargs
ldx curinst
inx
stx nxtinst
rts
extend
ldx curinst
inx
ldab ,x
inx
stx nxtinst
ldx #symtbl
abx
abx
ldx ,x
rts
getaddr
ldd curinst
addd #3
std nxtinst
ldx curinst
ldx 1,x
rts
getbyte
ldx curinst
inx
ldab ,x
inx
stx nxtinst
rts
getword
ldx curinst
inx
ldd ,x
inx
inx
stx nxtinst
rts
extbyte
ldd curinst
addd #3
std nxtinst
ldx curinst
ldab 2,x
pshb
ldab 1,x
ldx #symtbl
abx
abx
ldx ,x
pulb
rts
extword
ldd curinst
addd #4
std nxtinst
ldx curinst
ldd 2,x
pshb
ldab 1,x
ldx #symtbl
abx
abx
ldx ,x
pulb
rts
byteext
ldd curinst
addd #3
std nxtinst
ldx curinst
ldab 1,x
pshb
ldab 2,x
ldx #symtbl
abx
abx
ldx ,x
pulb
rts
wordext
ldd curinst
addd #4
std nxtinst
ldx curinst
ldd 1,x
pshb
ldab 3,x
ldx #symtbl
abx
abx
ldx ,x
pulb
rts
immstr
ldx curinst
inx
ldab ,x
inx
pshx
abx
stx nxtinst
pulx
rts
.module mdgeteq
geteq
beq _1
ldd #0
rts
_1
ldd #-1
rts
.module mdprint
print
_loop
ldaa ,x
jsr R_PUTC
inx
decb
bne _loop
rts
.module mdref1
; validate offset from 1D descriptor X and argv
; if empty desc, then alloc D bytes in array memory and 11 elements.
; return word offset in D and byte offset in tmp1
ref1
std tmp1
ldd ,x
bne _preexist
ldd strbuf
std ,x
ldd #11
std 2,x
ldd tmp1
pshx
jsr alloc
pulx
_preexist
ldd 0+argv
subd 2,x
bhi _err
ldd 0+argv
std tmp1
lsld
rts
_err
ldab #BS_ERROR
jmp error
.module mdrefint
; return int/str array reference in D/tmp1
refint
addd tmp1
addd 0,x
std tmp1
rts
.module mdstrdel
; remove a permanent string
; then re-link trailing strings
strdel
ldd 1,x
subd strbuf
blo _rts
ldd 1,x
subd strend
bhs _rts
ldd strend
subd #2
subb 0,x
sbca #0
std strend
ldab 0,x
ldx 1,x
dex
dex
stx tmp1
abx
inx
inx
sts tmp2
txs
ldx tmp1
_nxtwrd
pula
pulb
std ,x
inx
inx
cpx strend
blo _nxtwrd
lds tmp2
ldx tmp1
jmp strlink
_rts
rts
.module mdstreqbs
; compare string against bytecode "stack"
; ENTRY: tmp1+1 holds length, tmp2 holds compare
; EXIT: we return correct Z flag for caller
streqbs
ldx tmp2
jsr strrel
jsr immstr
sts tmp3
cmpb tmp1+1
bne _ne
tstb
beq _eq
txs
ldx tmp2
_nxtchr
pula
cmpa ,x
bne _ne
inx
decb
bne _nxtchr
_eq
lds tmp3
clra
rts
_ne
lds tmp3
rts
.module mdstrprm
; make a permanent string
; ENTRY: argv - input string descriptor
; X - output string descriptor
strprm
stx tmp1
ldab 0+argv
beq _null
decb
beq _char
ldx 1+argv
cpx #M_LBUF
blo _const
cpx #M_MSTR
blo _trans
cpx strbuf
blo _const
_trans
ldx tmp1
ldab 0,x
ldx 1,x
cpx strbuf
blo _nalloc
cmpb 0+argv
beq _copyip
_nalloc
cpx 1+argv
bhs _notmp
ldx 1+argv
cpx strend
bhs _notmp
ldx strend
inx
inx
stx strfree
bsr _copy
ldd strfree
std 1+argv
_notmp
ldx tmp1
pshx
jsr strdel
pulx
stx tmp1
ldx strend
ldd tmp1
std ,x
inx
inx
stx strfree
cpx argv+1
beq _nocopy
bsr _copy
bra _ready
_nocopy
ldab 0+argv
abx
_ready
stx strend
ldd strfree
inx
inx
stx strfree
clr strtcnt
ldx tmp1
std 1,x
ldab 0+argv
stab 0,x
rts
_char
ldaa #1
ldx 1+argv
ldab ,x
_null
ldaa #1
std 1+argv
_const
ldx tmp1
pshx
jsr strdel
pulx
ldab 0+argv
stab 0,x
ldd 1+argv
std 1,x
clr strtcnt
rts
_copyip
dex
dex
ldd tmp1
std ,x
inx
inx
_copy
sts tmp2
ldab 0+argv
lds 1+argv
des
_nxtchr
pula
staa ,x
inx
decb
bne _nxtchr
lds tmp2
clr strtcnt
rts
.module mdstrrel
; release a temporary string
; ENTRY: X holds string start
; EXIT: <all reg's preserved>
; sttrel should be called from:
; - ASC, VAL, LEN, PRINT
; - right hand side of strcat
; - relational operators
; - when LEFT$, MID$, RIGHT$ return null
strrel
cpx strend
bls _rts
cpx strstop
bhs _rts
tst strtcnt
beq _panic
dec strtcnt
beq _restore
stx strfree
_rts
rts
_restore
pshx
ldx strend
inx
inx
stx strfree
pulx
rts
_panic
ldab #1
jmp error
.module mdstrtmp
; make a temporary clone of a string
; ENTRY: X holds string start
; B holds string length
; EXIT: D holds new string pointer
strtmp
inc strtcnt
tstb
beq _null
sts tmp1
txs
ldx strfree
_nxtcp
pula
staa ,x
inx
decb
bne _nxtcp
lds tmp1
ldd strfree
stx strfree
rts
_null
ldd strfree
rts
arrdim1_ir1_sx ; numCalls = 1
.module modarrdim1_ir1_sx
jsr extend
ldd ,x
beq _ok
ldab #DD_ERROR
jmp error
_ok
ldd strbuf
std ,x
ldd r1+1
addd #1
std 2,x
lsld
addd 2,x
jmp alloc
arrref1_ir1_sx ; numCalls = 7
.module modarrref1_ir1_sx
jsr extend
ldd r1+1
std 0+argv
ldd #33
jsr ref1
jsr refint
std letptr
rts
arrval1_ir1_sx ; numCalls = 3
.module modarrval1_ir1_sx
jsr extend
ldd r1+1
std 0+argv
ldd #33
jsr ref1
jsr refint
ldx tmp1
ldab ,x
stab r1
ldd 1,x
std r1+1
rts
arrval1_ir2_sx ; numCalls = 6
.module modarrval1_ir2_sx
jsr extend
ldd r2+1
std 0+argv
ldd #33
jsr ref1
jsr refint
ldx tmp1
ldab ,x
stab r2
ldd 1,x
std r2+1
rts
clear ; numCalls = 1
.module modclear
jsr noargs
clra
ldx #bss
bra _start
_again
staa ,x
inx
_start
cpx #bes
bne _again
stx strbuf
stx strend
inx
inx
stx strfree
ldx #$8FFF
stx strstop
ldx #startdata
stx dataptr
rts
cls ; numCalls = 1
.module modcls
jsr noargs
jmp R_CLS
inkey_sr1 ; numCalls = 7
.module modinkey_sr1
jsr noargs
ldd #$0101
std r1
ldaa M_IKEY
bne _gotkey
jsr R_KEYIN
_gotkey
clr M_IKEY
staa r1+2
bne _rts
staa r1
_rts
rts
jmpne_ir1_ix ; numCalls = 7
.module modjmpne_ir1_ix
jsr getaddr
ldd r1+1
bne _go
ldaa r1
beq _rts
_go
stx nxtinst
_rts
rts
ld_ir1_pb ; numCalls = 11
.module modld_ir1_pb
jsr getbyte
stab r1+2
ldd #0
std r1
rts
ld_ir2_pb ; numCalls = 6
.module modld_ir2_pb
jsr getbyte
stab r2+2
ldd #0
std r2
rts
ld_sp_sr1 ; numCalls = 7
.module modld_sp_sr1
jsr noargs
ldx letptr
ldab r1
stab 0+argv
ldd r1+1
std 1+argv
jmp strprm
ld_sr1_ss ; numCalls = 7
.module modld_sr1_ss
ldx curinst
inx
ldab ,x
stab r1
inx
stx r1+1
abx
stx nxtinst
rts
ld_sx_sr1 ; numCalls = 9
.module modld_sx_sr1
jsr extend
ldab r1
stab 0+argv
ldd r1+1
std 1+argv
jmp strprm
ldeq_ir1_sr1_ss ; numCalls = 7
.module modldeq_ir1_sr1_ss
ldab r1
stab tmp1+1
ldd r1+1
std tmp2
jsr streqbs
jsr geteq
std r1+1
stab r1
rts
progbegin ; numCalls = 1
.module modprogbegin
jsr noargs
ldx R_MCXID
cpx #'h'*256+'C'
bne _mcbasic
pulx
clrb
pshb
pshb
pshb
stab strtcnt
jmp ,x
_reqmsg .text "?MICROCOLOR BASIC ROM REQUIRED"
_mcbasic
ldx #_reqmsg
ldab #30
jsr print
pulx
rts
progend ; numCalls = 1
.module modprogend
jsr noargs
pulx
pula
pula
pula
jsr R_RESET
jmp R_DMODE
NF_ERROR .equ 0
RG_ERROR .equ 4
OD_ERROR .equ 6
FC_ERROR .equ 8
OV_ERROR .equ 10
OM_ERROR .equ 12
BS_ERROR .equ 16
DD_ERROR .equ 18
LS_ERROR .equ 28
error
jmp R_ERROR
strcat_sr1_sr1_sr2 ; numCalls = 6
.module modstrcat_sr1_sr1_sr2
jsr noargs
ldx r2+1
jsr strrel
ldx r1+1
ldab r1
abx
stx strfree
addb r2
bcs _lserror
stab r1
ldab r2
ldx r2+1
jmp strtmp
_lserror
ldab #LS_ERROR
jmp error
strinit_sr1_sx ; numCalls = 6
.module modstrinit_sr1_sx
jsr extend
ldab 0,x
stab r1
ldx 1,x
jsr strtmp
std r1+1
rts
; data table
startdata
enddata
; Bytecode symbol lookup table
bytecode_STRVAR_D .equ 0
bytecode_STRVAR_E .equ 1
bytecode_STRVAR_F .equ 2
bytecode_STRARR_C .equ 3
symtbl
.word STRVAR_D
.word STRVAR_E
.word STRVAR_F
.word STRARR_C
; block started by symbol
bss
; Numeric Variables
; String Variables
STRVAR_D .block 3
STRVAR_E .block 3
STRVAR_F .block 3
; Numeric Arrays
; String Arrays
STRARR_C .block 4 ; dims=1
; block ended by symbol
bes
.end
| 13.276683 | 71 | 0.734277 | [
"MIT"
] | gregdionne/mcbasic | tests/arraystr-bytecode.asm | 16,171 | Assembly |
SECTION .text
GLOBAL test
test:
%define nop2 db 0x66, 0x90 ; 66 nop
%define nop3 db 0x0f, 0x1f, 0x00 ; nop DWORD ptr [EAX]
%define nop4 db 0x0f, 0x1f, 0x40, 0x00 ; nop DWORD ptr [EAX + 00H]
%define nop5 db 0x0f, 0x1f, 0x44, 0x00, 0x00 ; nop DWORD ptr [EAX + EAX*1 + 00H]
%define nop6 db 0x66, 0x0f, 0x1f, 0x44, 0x00, 0x00 ; 66 nop DWORD ptr [EAX + EAX*1 + 00H]
%define nop7 db 0x0f, 0x1f, 0x80, 0x00, 0x00, 0x00, 0x00 ; nop DWORD ptr [EAX + 00000000H]
%define nop8 db 0x0f, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00 ; nop DWORD ptr [EAX + EAX*1 + 00000000H]
%define nop9 db 0x66, 0x0f, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00 ; 66 nop WORD PTR [rax+rax*1+0x0]
%define nop10 db 0x66, 0x66, 0x0f, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00 ; data16 nop WORD PTR [rax+rax*1+0x0]
%define nop11 db 0x66, 0x66, 0x66, 0x0f, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00 ; data16 data16 nop WORD PTR [rax+rax*1+0x0]
nop
nop2
nop3
nop4
nop5
nop6
nop7
nop8
nop9
nop10
nop11 | 52.041667 | 126 | 0.530024 | [
"Apache-2.0"
] | cryptoptusenix/assemblyline | test/nop.asm | 1,249 | Assembly |
; A021332: Decimal expansion of 1/328.
; 0,0,3,0,4,8,7,8,0,4,8,7,8,0,4,8,7,8,0,4,8,7,8,0,4,8,7,8,0,4,8,7,8,0,4,8,7,8,0,4,8,7,8,0,4,8,7,8,0,4,8,7,8,0,4,8,7,8,0,4,8,7,8,0,4,8,7,8,0,4,8,7,8,0,4,8,7,8,0,4,8,7,8,0,4,8,7,8,0,4,8,7,8,0,4,8,7,8,0
add $0,1
mov $1,10
pow $1,$0
mul $1,9
div $1,2952
mod $1,10
mov $0,$1
| 28.181818 | 199 | 0.541935 | [
"Apache-2.0"
] | ckrause/cm | programs/oeis/021/A021332.asm | 310 | Assembly |
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r9
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_normal_ht+0x15d58, %rsi
lea addresses_WT_ht+0x1070, %rdi
nop
nop
and %rdx, %rdx
mov $74, %rcx
rep movsq
nop
nop
cmp $36951, %rsi
lea addresses_WC_ht+0x1c470, %r11
nop
nop
nop
nop
nop
sub %rdi, %rdi
movw $0x6162, (%r11)
nop
nop
nop
nop
inc %rcx
lea addresses_WT_ht+0x1670, %rsi
lea addresses_A_ht+0xef10, %rdi
nop
nop
nop
and %r11, %r11
mov $108, %rcx
rep movsl
xor $63389, %rdx
lea addresses_A_ht+0x41f8, %rsi
lea addresses_normal_ht+0x5ef0, %rdi
nop
add $33995, %r9
mov $2, %rcx
rep movsq
nop
nop
nop
nop
add $32703, %r10
lea addresses_normal_ht+0x111f0, %rdi
nop
nop
nop
nop
inc %rcx
mov (%rdi), %r10d
nop
nop
nop
nop
nop
add $52374, %r11
lea addresses_WC_ht+0x17030, %rdi
nop
nop
nop
nop
nop
cmp $37929, %rsi
mov (%rdi), %rdx
nop
nop
nop
nop
nop
inc %r9
lea addresses_D_ht+0xec50, %rdx
nop
nop
nop
nop
nop
dec %r11
mov $0x6162636465666768, %rdi
movq %rdi, (%rdx)
nop
add %r11, %r11
lea addresses_WT_ht+0x15c70, %rdx
nop
cmp %rcx, %rcx
mov $0x6162636465666768, %r9
movq %r9, %xmm2
vmovups %ymm2, (%rdx)
nop
nop
sub $59273, %rdi
lea addresses_UC_ht+0x17cec, %rsi
lea addresses_A_ht+0x1a370, %rdi
clflush (%rdi)
nop
cmp $47988, %r9
mov $60, %rcx
rep movsl
nop
nop
inc %r9
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r9
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r14
push %r9
push %rbp
push %rdx
// Faulty Load
lea addresses_normal+0x1c870, %r13
nop
nop
nop
sub %rbp, %rbp
mov (%r13), %r10
lea oracles, %rbp
and $0xff, %r10
shlq $12, %r10
mov (%rbp,%r10,1), %r10
pop %rdx
pop %rbp
pop %r9
pop %r14
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'NT': True, 'AVXalign': False, 'size': 1, 'type': 'addresses_normal', 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': True, 'size': 8, 'type': 'addresses_normal', 'congruent': 0}}
<gen_prepare_buffer>
{'dst': {'same': False, 'congruent': 11, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 2, 'type': 'addresses_normal_ht'}}
{'dst': {'same': False, 'NT': True, 'AVXalign': False, 'size': 2, 'type': 'addresses_WC_ht', 'congruent': 9}, 'OP': 'STOR'}
{'dst': {'same': False, 'congruent': 4, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 9, 'type': 'addresses_WT_ht'}}
{'dst': {'same': False, 'congruent': 6, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 3, 'type': 'addresses_A_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_normal_ht', 'congruent': 7}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_WC_ht', 'congruent': 4}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_D_ht', 'congruent': 4}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_WT_ht', 'congruent': 9}, 'OP': 'STOR'}
{'dst': {'same': False, 'congruent': 4, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 1, 'type': 'addresses_UC_ht'}}
{'34': 21829}
34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34
*/
| 37.656627 | 2,999 | 0.662134 | [
"MIT"
] | danielmgmi/medusa | Transynther/_processed/AVXALIGN/_st_/i7-7700_9_0x48_notsx.log_21829_1114.asm | 6,251 | Assembly |
;;
;; Copyright (c) 2017-2018, Intel Corporation
;;
;; Redistribution and use in source and binary forms, with or without
;; modification, are permitted provided that the following conditions are met:
;;
;; * Redistributions of source code must retain the above copyright notice,
;; this list of conditions and the following disclaimer.
;; * Redistributions in binary form must reproduce the above copyright
;; notice, this list of conditions and the following disclaimer in the
;; documentation and/or other materials provided with the distribution.
;; * Neither the name of Intel Corporation nor the names of its contributors
;; may be used to endorse or promote products derived from this software
;; without specific prior written permission.
;;
;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
;; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
;; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
;; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
;; CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
;; OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
;; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;;
%define SHA224
%include "mb_mgr_hmac_sha_256_submit_avx512.asm"
| 56.689655 | 81 | 0.762165 | [
"Apache-2.0"
] | intel/oim | vendor/github.com/spdk/spdk/intel-ipsec-mb/avx512/mb_mgr_hmac_sha_224_submit_avx512.asm | 1,644 | Assembly |
;;
;; Copyright (c) 2019-2021, Intel Corporation
;;
;; Redistribution and use in source and binary forms, with or without
;; modification, are permitted provided that the following conditions are met:
;;
;; * Redistributions of source code must retain the above copyright notice,
;; this list of conditions and the following disclaimer.
;; * Redistributions in binary form must reproduce the above copyright
;; notice, this list of conditions and the following disclaimer in the
;; documentation and/or other materials provided with the distribution.
;; * Neither the name of Intel Corporation nor the names of its contributors
;; may be used to endorse or promote products derived from this software
;; without specific prior written permission.
;;
;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
;; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
;; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
;; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
;; CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
;; OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
;; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;;
;;; routines to do 128/192/256 bit CBC AES encrypt
%include "include/os.asm"
%include "include/mb_mgr_datastruct.asm"
%include "include/reg_sizes.asm"
%include "include/clear_regs.asm"
%include "include/cet.inc"
struc STACK
_gpr_save: resq 4
endstruc
%define GPR_SAVE_AREA rsp + _gpr_save
%ifdef LINUX
%define arg1 rdi
%define arg2 rsi
%define arg3 rcx
%define arg4 rdx
%else
%define arg1 rcx
%define arg2 rdx
%define arg3 rdi
%define arg4 rsi
%endif
%define ARG arg1
%define LEN arg2
%define IA0 rax
%define IA1 rbx
%define IA2 arg3
%define IN arg4
%define OUT rbp
%define IN_L0 r8
%define IN_L1 r9
%define IN_L2 r10
%define IN_L3 r11
%define IN_L8 r12
%define IN_L9 r13
%define IN_L10 r14
%define IN_L11 r15
%define ZIV00_03 zmm8
%define ZIV04_07 zmm9
%define ZIV08_11 zmm10
%define ZIV12_15 zmm11
%define ZT0 zmm16
%define ZT1 zmm17
%define ZT2 zmm18
%define ZT3 zmm19
%define ZT4 zmm20
%define ZT5 zmm21
%define ZT6 zmm22
%define ZT7 zmm23
%define ZT8 zmm24
%define ZT9 zmm25
%define ZT10 zmm26
%define ZT11 zmm27
%define ZT12 zmm28
%define ZT13 zmm29
%define ZT14 zmm30
%define ZT15 zmm31
%define ZT16 zmm12
%define ZT17 zmm13
%define ZT18 zmm14
%define ZT19 zmm15
%define TAB_A0B0A1B1 zmm6
%define TAB_A2B2A3B3 zmm7
%define R0_K0_3 zmm0
%define R0_K4_7 zmm1
%define R0_K8_11 zmm2
%define R2_K0_3 zmm3
%define R2_K4_7 zmm4
%define R2_K8_11 zmm5
%define MAC_TYPE_NONE 0
%define MAC_TYPE_CBC 1
%define MAC_TYPE_XCBC 2
;; Save registers states
%macro FUNC_SAVE 0
sub rsp, STACK_size
mov [GPR_SAVE_AREA + 8*0], rbp
%ifndef LINUX
mov [GPR_SAVE_AREA + 8*1], rsi
mov [GPR_SAVE_AREA + 8*2], rdi
%endif
mov [GPR_SAVE_AREA + 8*3], r15
%endmacro
;; Restore register states
%macro FUNC_RESTORE 0
;; XMMs are saved at a higher level
mov rbp, [GPR_SAVE_AREA + 8*0]
%ifndef LINUX
mov rsi, [GPR_SAVE_AREA + 8*1]
mov rdi, [GPR_SAVE_AREA + 8*2]
%endif
mov r15, [GPR_SAVE_AREA + 8*3]
add rsp, STACK_size
vzeroupper
%endmacro
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Transpose macro - executes 4x4 transpose of 4 ZMM registers
; in: L0B0-3 out: B0L0-3
; L1B0-3 B1L0-3
; L2B0-3 B2L0-3
; L3B0-3 B3L0-3
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
%macro TRANSPOSE_4x4 8
%define %%IN_OUT_0 %1
%define %%IN_OUT_1 %2
%define %%IN_OUT_2 %3
%define %%IN_OUT_3 %4
%define %%ZTMP_0 %5
%define %%ZTMP_1 %6
%define %%ZTMP_2 %7
%define %%ZTMP_3 %8
vmovdqa64 %%ZTMP_0, TAB_A0B0A1B1
vmovdqa64 %%ZTMP_1, %%ZTMP_0
vmovdqa64 %%ZTMP_2, TAB_A2B2A3B3
vmovdqa64 %%ZTMP_3, %%ZTMP_2
vpermi2q %%ZTMP_0, %%IN_OUT_0, %%IN_OUT_1
vpermi2q %%ZTMP_1, %%IN_OUT_2, %%IN_OUT_3
vpermi2q %%ZTMP_2, %%IN_OUT_0, %%IN_OUT_1
vpermi2q %%ZTMP_3, %%IN_OUT_2, %%IN_OUT_3
vshufi64x2 %%IN_OUT_0, %%ZTMP_0, %%ZTMP_1, 0x44
vshufi64x2 %%IN_OUT_2, %%ZTMP_2, %%ZTMP_3, 0x44
vshufi64x2 %%IN_OUT_1, %%ZTMP_0, %%ZTMP_1, 0xee
vshufi64x2 %%IN_OUT_3, %%ZTMP_2, %%ZTMP_3, 0xee
%endmacro
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; LOAD_STORE - loads/stores 1-4 blocks (16 bytes) for 4 lanes into ZMM registers
; - Loads 4 blocks by default
; - Pass %%MASK_REG argument to load/store 1-3 blocks (optional)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
%macro LOAD_STORE_x4 13-14
%define %%LANE_A %1 ; [in] lane index to load/store (numerical)
%define %%LANE_B %2 ; [in] lane index to load/store (numerical)
%define %%LANE_C %3 ; [in] lane index to load/store (numerical)
%define %%LANE_D %4 ; [in] lane index to load/store (numerical)
%define %%DATA_PTR %5 ; [in] GP reg with ptr to lane input table
%define %%OFFSET %6 ; [in] GP reg input/output buffer offset
%define %%ZDATA0 %7 ; [in/out] ZMM reg to load/store data
%define %%ZDATA1 %8 ; [in/out] ZMM reg to load/store data
%define %%ZDATA2 %9 ; [in/out] ZMM reg to load/store data
%define %%ZDATA3 %10 ; [in/out] ZMM reg to load/store data
%define %%GP0 %11 ; [clobbered] tmp GP reg
%define %%GP1 %12 ; [clobbered] tmp GP reg
%define %%LOAD_STORE %13 ; [in] string value to select LOAD or STORE
%define %%MASK_REG %14 ; [in] mask reg used for load/store mask
%define %%NUM_ARGS %0
mov %%GP0, [%%DATA_PTR + 8*(%%LANE_A)]
mov %%GP1, [%%DATA_PTR + 8*(%%LANE_B)]
%if %%NUM_ARGS <= 13 ;; %%MASK_REG not set, assume 4 block load/store
%ifidn %%LOAD_STORE, LOAD
vmovdqu8 %%ZDATA0, [%%GP0 + %%OFFSET]
vmovdqu8 %%ZDATA1, [%%GP1 + %%OFFSET]
mov %%GP0, [%%DATA_PTR + 8*(%%LANE_C)]
mov %%GP1, [%%DATA_PTR + 8*(%%LANE_D)]
vmovdqu8 %%ZDATA2, [%%GP0 + %%OFFSET]
vmovdqu8 %%ZDATA3, [%%GP1 + %%OFFSET]
%else ; STORE
vmovdqu8 [%%GP0 + %%OFFSET], %%ZDATA0
vmovdqu8 [%%GP1 + %%OFFSET], %%ZDATA1
mov %%GP0, [%%DATA_PTR + 8*(%%LANE_C)]
mov %%GP1, [%%DATA_PTR + 8*(%%LANE_D)]
vmovdqu8 [%%GP0 + %%OFFSET], %%ZDATA2
vmovdqu8 [%%GP1 + %%OFFSET], %%ZDATA3
%endif
%else ;; %%MASK_REG argument passed - 1, 2, or 3 block load/store
%ifidn %%LOAD_STORE, LOAD
vmovdqu8 %%ZDATA0{%%MASK_REG}{z}, [%%GP0 + %%OFFSET]
vmovdqu8 %%ZDATA1{%%MASK_REG}{z}, [%%GP1 + %%OFFSET]
mov %%GP0, [%%DATA_PTR + 8*(%%LANE_C)]
mov %%GP1, [%%DATA_PTR + 8*(%%LANE_D)]
vmovdqu8 %%ZDATA2{%%MASK_REG}{z}, [%%GP0 + %%OFFSET]
vmovdqu8 %%ZDATA3{%%MASK_REG}{z}, [%%GP1 + %%OFFSET]
%else ; STORE
vmovdqu8 [%%GP0 + %%OFFSET]{%%MASK_REG}, %%ZDATA0
vmovdqu8 [%%GP1 + %%OFFSET]{%%MASK_REG}, %%ZDATA1
mov %%GP0, [%%DATA_PTR + 8*(%%LANE_C)]
mov %%GP1, [%%DATA_PTR + 8*(%%LANE_D)]
vmovdqu8 [%%GP0 + %%OFFSET]{%%MASK_REG}, %%ZDATA2
vmovdqu8 [%%GP1 + %%OFFSET]{%%MASK_REG}, %%ZDATA3
%endif
%endif ;; %%NUM_ARGS
%endmacro
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; PRELOADED_LOAD_STORE - loads/stores 1-4 blocks for 4 lanes into ZMM registers
; - Input pointers are already loaded into GP registers
; - Loads 4 blocks by default
; - Pass %%MASK_REG argument to load/store 1-3 blocks (optional)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
%macro PRELOADED_LOAD_STORE_x4 10-11
%define %%IN0 %1 ; [in] GP reg with lane input pointer
%define %%IN1 %2 ; [in] GP reg with lane input pointer
%define %%IN2 %3 ; [in] GP reg with lane input pointer
%define %%IN3 %4 ; [in] GP reg with lane input pointer
%define %%OFFSET %5 ; [in] GP reg input/output buffer offset
%define %%ZDATA0 %6 ; [in/out] ZMM reg to load/store data
%define %%ZDATA1 %7 ; [in/out] ZMM reg to load/store data
%define %%ZDATA2 %8 ; [in/out] ZMM reg to load/store data
%define %%ZDATA3 %9 ; [in/out] ZMM reg to load/store data
%define %%LOAD_STORE %10 ; [in] string value to select LOAD or STORE
%define %%MASK_REG %11 ; [in] mask reg used for load/store mask
%define %%NUM_ARGS %0
%if %%NUM_ARGS <= 10 ;; %%MASK_REG not set, assume 4 block load/store
%ifidn %%LOAD_STORE, LOAD
vmovdqu8 %%ZDATA0, [%%IN0 + %%OFFSET]
vmovdqu8 %%ZDATA1, [%%IN1 + %%OFFSET]
vmovdqu8 %%ZDATA2, [%%IN2 + %%OFFSET]
vmovdqu8 %%ZDATA3, [%%IN3 + %%OFFSET]
%else ; STORE
vmovdqu8 [%%IN0 + %%OFFSET], %%ZDATA0
vmovdqu8 [%%IN1 + %%OFFSET], %%ZDATA1
vmovdqu8 [%%IN2 + %%OFFSET], %%ZDATA2
vmovdqu8 [%%IN3 + %%OFFSET], %%ZDATA3
%endif
%else ;; %%MASK_REG argument passed - 1, 2, or 3 block load/store
%ifidn %%LOAD_STORE, LOAD
vmovdqu8 %%ZDATA0{%%MASK_REG}{z}, [%%IN0 + %%OFFSET]
vmovdqu8 %%ZDATA1{%%MASK_REG}{z}, [%%IN1 + %%OFFSET]
vmovdqu8 %%ZDATA2{%%MASK_REG}{z}, [%%IN2 + %%OFFSET]
vmovdqu8 %%ZDATA3{%%MASK_REG}{z}, [%%IN3 + %%OFFSET]
%else ; STORE
vmovdqu8 [%%IN0 + %%OFFSET]{%%MASK_REG}, %%ZDATA0
vmovdqu8 [%%IN1 + %%OFFSET]{%%MASK_REG}, %%ZDATA1
vmovdqu8 [%%IN2 + %%OFFSET]{%%MASK_REG}, %%ZDATA2
vmovdqu8 [%%IN3 + %%OFFSET]{%%MASK_REG}, %%ZDATA3
%endif
%endif ;; %%NUM_ARGS
%endmacro
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; AESENC_ROUNDS_x16 macro
; - 16 lanes, 1 block per lane
; - performs AES encrypt rounds 1-NROUNDS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
%macro AESENC_ROUNDS_x16 6
%define %%L00_03 %1 ; [in/out] ZMM with lane 0-3 blocks
%define %%L04_07 %2 ; [in/out] ZMM with lane 4-7 blocks
%define %%L08_11 %3 ; [in/out] ZMM with lane 8-11 blocks
%define %%L12_15 %4 ; [in/out] ZMM with lane 12-15 blocks
%define %%KP %5 ; [in] key table pointer
%define %%NROUNDS %6 ; [in] number of aes rounds
%define %%K00_03_OFFSET 0
%define %%K04_07_OFFSET 64
%define %%K08_11_OFFSET 128
%define %%K12_15_OFFSET 192
%assign ROUND 1
%rep (%%NROUNDS + 1)
%if ROUND <= %%NROUNDS
%if ROUND == 2 ;; round 2 keys preloaded for some lanes
vaesenc %%L00_03, %%L00_03, R2_K0_3
vaesenc %%L04_07, %%L04_07, R2_K4_7
vaesenc %%L08_11, %%L08_11, R2_K8_11
vaesenc %%L12_15, %%L12_15, [%%KP + %%K12_15_OFFSET + ROUND * (16*16)]
%else
;; rounds 1 to 9/11/13
vaesenc %%L00_03, %%L00_03, [%%KP + %%K00_03_OFFSET + ROUND * (16*16)]
vaesenc %%L04_07, %%L04_07, [%%KP + %%K04_07_OFFSET + ROUND * (16*16)]
vaesenc %%L08_11, %%L08_11, [%%KP + %%K08_11_OFFSET + ROUND * (16*16)]
vaesenc %%L12_15, %%L12_15, [%%KP + %%K12_15_OFFSET + ROUND * (16*16)]
%endif
%else
;; the last round
vaesenclast %%L00_03, %%L00_03, [%%KP + %%K00_03_OFFSET + ROUND * (16*16)]
vaesenclast %%L04_07, %%L04_07, [%%KP + %%K04_07_OFFSET + ROUND * (16*16)]
vaesenclast %%L08_11, %%L08_11, [%%KP + %%K08_11_OFFSET + ROUND * (16*16)]
vaesenclast %%L12_15, %%L12_15, [%%KP + %%K12_15_OFFSET + ROUND * (16*16)]
%endif
%assign ROUND (ROUND + 1)
%endrep
%endmacro ; AESENC_ROUNDS_x16
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ENCRYPT_16_PARALLEL - Encode all blocks up to multiple of 4
; - Operation
; - loop encrypting %%LENGTH bytes of input data
; - each loop encrypts 4 blocks across 16 lanes
; - stop when %%LENGTH is less than 64 bytes (4 blocks)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
%macro ENCRYPT_16_PARALLEL 30
%define %%ZIV00_03 %1 ;; [in] lane 0-3 IVs
%define %%ZIV04_07 %2 ;; [in] lane 4-7 IVs
%define %%ZIV08_11 %3 ;; [in] lane 8-11 IVs
%define %%ZIV12_15 %4 ;; [in] lane 12-15 IVs
%define %%LENGTH %5 ;; [in/out] GP register with length in bytes
%define %%NROUNDS %6 ;; [in] Number of AES rounds; numerical value
%define %%IDX %7 ;; [clobbered] GP reg to maintain idx
%define %%B0L00_03 %8 ;; [clobbered] tmp ZMM register
%define %%B0L04_07 %9 ;; [clobbered] tmp ZMM register
%define %%B0L08_11 %10 ;; [clobbered] tmp ZMM register
%define %%B0L12_15 %11 ;; [clobbered] tmp ZMM register
%define %%B1L00_03 %12 ;; [clobbered] tmp ZMM register
%define %%B1L04_07 %13 ;; [clobbered] tmp ZMM register
%define %%B1L08_11 %14 ;; [clobbered] tmp ZMM register
%define %%B1L12_15 %15 ;; [clobbered] tmp ZMM register
%define %%B2L00_03 %16 ;; [clobbered] tmp ZMM register
%define %%B2L04_07 %17 ;; [clobbered] tmp ZMM register
%define %%B2L08_11 %18 ;; [clobbered] tmp ZMM register
%define %%B2L12_15 %19 ;; [clobbered] tmp ZMM register
%define %%B3L00_03 %20 ;; [clobbered] tmp ZMM register
%define %%B3L04_07 %21 ;; [clobbered] tmp ZMM register
%define %%B3L08_11 %22 ;; [clobbered] tmp ZMM register
%define %%B3L12_15 %23 ;; [clobbered] tmp ZMM register
%define %%ZTMP0 %24 ;; [clobbered] tmp ZMM register
%define %%ZTMP1 %25 ;; [clobbered] tmp ZMM register
%define %%ZTMP2 %26 ;; [clobbered] tmp ZMM register
%define %%ZTMP3 %27 ;; [clobbered] tmp ZMM register
%define %%TMP0 %28 ;; [clobbered] tmp GP register
%define %%TMP1 %29 ;; [clobbered] tmp GP register
%define %%MAC_TYPE %30 ;; MAC_TYPE_NONE/CBC/XCBC flag
%if %%MAC_TYPE == MAC_TYPE_XCBC
%define %%KP ARG + _aes_xcbc_args_key_tab
%else
%define %%KP ARG + _aesarg_key_tab
%endif
%define %%K00_03_OFFSET 0
%define %%K04_07_OFFSET 64
%define %%K08_11_OFFSET 128
%define %%K12_15_OFFSET 192
;; check for at least 4 blocks
cmp %%LENGTH, 64
jl %%encrypt_16_done
xor %%IDX, %%IDX
;; skip length check on first loop
jmp %%encrypt_16_first
%%encrypt_16_start:
cmp %%LENGTH, 64
jl %%encrypt_16_end
%%encrypt_16_first:
;; load 4 plaintext blocks for lanes 0-3
PRELOADED_LOAD_STORE_x4 IN_L0, IN_L1, IN_L2, IN_L3, %%IDX, \
%%B0L00_03, %%B1L00_03, %%B2L00_03, \
%%B3L00_03, LOAD
TRANSPOSE_4x4 %%B0L00_03, %%B1L00_03, %%B2L00_03, %%B3L00_03, \
%%ZTMP0, %%ZTMP1, %%ZTMP2, %%ZTMP3
;; load 4 plaintext blocks for lanes 4-7
LOAD_STORE_x4 4, 5, 6, 7, IN, %%IDX, %%B0L04_07, %%B1L04_07, \
%%B2L04_07, %%B3L04_07, %%TMP0, %%TMP1, LOAD
TRANSPOSE_4x4 %%B0L04_07, %%B1L04_07, %%B2L04_07, %%B3L04_07, \
%%ZTMP0, %%ZTMP1, %%ZTMP2, %%ZTMP3
;; load 4 plaintext blocks for lanes 8-11
PRELOADED_LOAD_STORE_x4 IN_L8, IN_L9, IN_L10, IN_L11, %%IDX, \
%%B0L08_11, %%B1L08_11, %%B2L08_11, \
%%B3L08_11, LOAD
TRANSPOSE_4x4 %%B0L08_11, %%B1L08_11, %%B2L08_11, %%B3L08_11, \
%%ZTMP0, %%ZTMP1, %%ZTMP2, %%ZTMP3
;; load 4 plaintext blocks for lanes 12-15
LOAD_STORE_x4 12, 13, 14, 15, IN, %%IDX, %%B0L12_15, %%B1L12_15, \
%%B2L12_15, %%B3L12_15, %%TMP0, %%TMP1, LOAD
TRANSPOSE_4x4 %%B0L12_15, %%B1L12_15, %%B2L12_15, %%B3L12_15, \
%%ZTMP0, %%ZTMP1, %%ZTMP2, %%ZTMP3
;; xor first plaintext block with IV and round zero key
vpternlogq %%B0L00_03, %%ZIV00_03, R0_K0_3, 0x96
vpternlogq %%B0L04_07, %%ZIV04_07, R0_K4_7, 0x96
vpternlogq %%B0L08_11, %%ZIV08_11, R0_K8_11, 0x96
vpternlogq %%B0L12_15, %%ZIV12_15, [%%KP + %%K12_15_OFFSET], 0x96
;; encrypt block 0 lanes
AESENC_ROUNDS_x16 %%B0L00_03, %%B0L04_07, %%B0L08_11, %%B0L12_15, %%KP, %%NROUNDS
;; xor plaintext block with last cipher block and round zero key
vpternlogq %%B1L00_03, %%B0L00_03, R0_K0_3, 0x96
vpternlogq %%B1L04_07, %%B0L04_07, R0_K4_7, 0x96
vpternlogq %%B1L08_11, %%B0L08_11, R0_K8_11, 0x96
vpternlogq %%B1L12_15, %%B0L12_15, [%%KP + %%K12_15_OFFSET], 0x96
;; encrypt block 1 lanes
AESENC_ROUNDS_x16 %%B1L00_03, %%B1L04_07, %%B1L08_11, %%B1L12_15, %%KP, %%NROUNDS
;; xor plaintext block with last cipher block and round zero key
vpternlogq %%B2L00_03, %%B1L00_03, R0_K0_3, 0x96
vpternlogq %%B2L04_07, %%B1L04_07, R0_K4_7, 0x96
vpternlogq %%B2L08_11, %%B1L08_11, R0_K8_11, 0x96
vpternlogq %%B2L12_15, %%B1L12_15, [%%KP + %%K12_15_OFFSET], 0x96
;; encrypt block 2 lanes
AESENC_ROUNDS_x16 %%B2L00_03, %%B2L04_07, %%B2L08_11, %%B2L12_15, %%KP, %%NROUNDS
;; xor plaintext block with last cipher block and round zero key
vpternlogq %%B3L00_03, %%B2L00_03, R0_K0_3, 0x96
vpternlogq %%B3L04_07, %%B2L04_07, R0_K4_7, 0x96
vpternlogq %%B3L08_11, %%B2L08_11, R0_K8_11, 0x96
vpternlogq %%B3L12_15, %%B2L12_15, [%%KP + %%K12_15_OFFSET], 0x96
;; encrypt block 3 lanes
AESENC_ROUNDS_x16 %%B3L00_03, %%B3L04_07, %%B3L08_11, %%B3L12_15, %%KP, %%NROUNDS
;; store last cipher block
vmovdqa64 %%ZIV00_03, %%B3L00_03
vmovdqa64 %%ZIV04_07, %%B3L04_07
vmovdqa64 %%ZIV08_11, %%B3L08_11
vmovdqa64 %%ZIV12_15, %%B3L12_15
;; Don't write back ciphertext for CBC-MAC
%if %%MAC_TYPE == MAC_TYPE_NONE
;; write back cipher text for lanes 0-3
TRANSPOSE_4x4 %%B0L00_03, %%B1L00_03, %%B2L00_03, %%B3L00_03, \
%%ZTMP0, %%ZTMP1, %%ZTMP2, %%ZTMP3
LOAD_STORE_x4 0, 1, 2, 3, OUT, %%IDX, %%B0L00_03, %%B1L00_03, \
%%B2L00_03, %%B3L00_03, %%TMP0, %%TMP1, STORE
;; write back cipher text for lanes 4-7
TRANSPOSE_4x4 %%B0L04_07, %%B1L04_07, %%B2L04_07, %%B3L04_07, \
%%ZTMP0, %%ZTMP1, %%ZTMP2, %%ZTMP3
LOAD_STORE_x4 4, 5, 6, 7, OUT, %%IDX, %%B0L04_07, %%B1L04_07, \
%%B2L04_07, %%B3L04_07, %%TMP0, %%TMP1, STORE
;; write back cipher text for lanes 8-11
TRANSPOSE_4x4 %%B0L08_11, %%B1L08_11, %%B2L08_11, %%B3L08_11, \
%%ZTMP0, %%ZTMP1, %%ZTMP2, %%ZTMP3
LOAD_STORE_x4 8, 9, 10, 11, OUT, %%IDX, %%B0L08_11, %%B1L08_11, \
%%B2L08_11, %%B3L08_11, %%TMP0, %%TMP1, STORE
;; write back cipher text for lanes 12-15
TRANSPOSE_4x4 %%B0L12_15, %%B1L12_15, %%B2L12_15, %%B3L12_15, \
%%ZTMP0, %%ZTMP1, %%ZTMP2, %%ZTMP3
LOAD_STORE_x4 12, 13, 14, 15, OUT, %%IDX, %%B0L12_15, %%B1L12_15, \
%%B2L12_15, %%B3L12_15, %%TMP0, %%TMP1, STORE
%endif ;; MAC_TYPE
sub %%LENGTH, 64
add %%IDX, 64
jmp %%encrypt_16_start
%%encrypt_16_end:
;; update in/out pointers
vpbroadcastq %%ZTMP2, %%IDX
vpaddq %%ZTMP0, %%ZTMP2, [IN]
vpaddq %%ZTMP1, %%ZTMP2, [IN + 64]
vmovdqa64 [IN], %%ZTMP0
vmovdqa64 [IN + 64], %%ZTMP1
add IN_L0, %%IDX
add IN_L1, %%IDX
add IN_L2, %%IDX
add IN_L3, %%IDX
add IN_L8, %%IDX
add IN_L9, %%IDX
add IN_L10, %%IDX
add IN_L11, %%IDX
%if %%MAC_TYPE == MAC_TYPE_NONE ;; skip out pointer update for CBC_MAC/XCBC
vpaddq %%ZTMP0, %%ZTMP2, [OUT]
vpaddq %%ZTMP1, %%ZTMP2, [OUT + 64]
vmovdqa64 [OUT], %%ZTMP0
vmovdqa64 [OUT + 64], %%ZTMP1
%endif ;; MAC_TYPE
%%encrypt_16_done:
%endmacro
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ENCRYPT_16_FINAL Encodes final blocks (less than 4) across 16 lanes
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
%macro ENCRYPT_16_FINAL 30
%define %%ZIV00_03 %1 ;; [in] lane 0-3 IVs
%define %%ZIV04_07 %2 ;; [in] lane 4-7 IVs
%define %%ZIV08_11 %3 ;; [in] lane 8-11 IVs
%define %%ZIV12_15 %4 ;; [in] lane 12-15 IVs
%define %%NROUNDS %5 ;; [in] Number of AES rounds; numerical value
%define %%IDX %6 ;; [clobbered] GP reg to maintain idx
%define %%B0L00_03 %7 ;; [clobbered] tmp ZMM register
%define %%B0L04_07 %8 ;; [clobbered] tmp ZMM register
%define %%B0L08_11 %9 ;; [clobbered] tmp ZMM register
%define %%B0L12_15 %10 ;; [clobbered] tmp ZMM register
%define %%B1L00_03 %11 ;; [clobbered] tmp ZMM register
%define %%B1L04_07 %12 ;; [clobbered] tmp ZMM register
%define %%B1L08_11 %13 ;; [clobbered] tmp ZMM register
%define %%B1L12_15 %14 ;; [clobbered] tmp ZMM register
%define %%B2L00_03 %15 ;; [clobbered] tmp ZMM register
%define %%B2L04_07 %16 ;; [clobbered] tmp ZMM register
%define %%B2L08_11 %17 ;; [clobbered] tmp ZMM register
%define %%B2L12_15 %18 ;; [clobbered] tmp ZMM register
%define %%B3L00_03 %19 ;; [clobbered] tmp ZMM register
%define %%B3L04_07 %20 ;; [clobbered] tmp ZMM register
%define %%B3L08_11 %21 ;; [clobbered] tmp ZMM register
%define %%B3L12_15 %22 ;; [clobbered] tmp ZMM register
%define %%ZTMP0 %23 ;; [clobbered] tmp ZMM register
%define %%ZTMP1 %24 ;; [clobbered] tmp ZMM register
%define %%ZTMP2 %25 ;; [clobbered] tmp ZMM register
%define %%ZTMP3 %26 ;; [clobbered] tmp ZMM register
%define %%TMP0 %27 ;; [clobbered] tmp GP register
%define %%TMP1 %28 ;; [clobbered] tmp GP register
%define %%NUM_BLKS %29 ;; [in] number of blocks (numerical value)
%define %%MAC_TYPE %30 ;; MAC_TYPE_NONE/CBC/XCBC flag
%if %%MAC_TYPE == MAC_TYPE_XCBC
%define %%KP ARG + _aesxcbcarg_key_tab
%else
%define %%KP ARG + _aesarg_key_tab
%endif
%define %%K00_03_OFFSET 0
%define %%K04_07_OFFSET 64
%define %%K08_11_OFFSET 128
%define %%K12_15_OFFSET 192
%if %%NUM_BLKS == 1
mov %%TMP0, 0x0000_0000_0000_ffff
kmovq k1, %%TMP0
%elif %%NUM_BLKS == 2
mov %%TMP0, 0x0000_0000_ffff_ffff
kmovq k1, %%TMP0
%elif %%NUM_BLKS == 3
mov %%TMP0, 0x0000_ffff_ffff_ffff
kmovq k1, %%TMP0
%endif
xor %%IDX, %%IDX
;; load 4 plaintext blocks for lanes 0-3
PRELOADED_LOAD_STORE_x4 IN_L0, IN_L1, IN_L2, IN_L3, %%IDX, \
%%B0L00_03, %%B1L00_03, %%B2L00_03, \
%%B3L00_03, LOAD, k1
TRANSPOSE_4x4 %%B0L00_03, %%B1L00_03, %%B2L00_03, %%B3L00_03, \
%%ZTMP0, %%ZTMP1, %%ZTMP2, %%ZTMP3
;; load 4 plaintext blocks for lanes 4-7
LOAD_STORE_x4 4, 5, 6, 7, IN, %%IDX, %%B0L04_07, %%B1L04_07, \
%%B2L04_07, %%B3L04_07, %%TMP0, %%TMP1, LOAD, k1
TRANSPOSE_4x4 %%B0L04_07, %%B1L04_07, %%B2L04_07, %%B3L04_07, \
%%ZTMP0, %%ZTMP1, %%ZTMP2, %%ZTMP3
;; load 4 plaintext blocks for lanes 8-11
PRELOADED_LOAD_STORE_x4 IN_L8, IN_L9, IN_L10, IN_L11, %%IDX, \
%%B0L08_11, %%B1L08_11, %%B2L08_11, \
%%B3L08_11, LOAD, k1
TRANSPOSE_4x4 %%B0L08_11, %%B1L08_11, %%B2L08_11, %%B3L08_11, \
%%ZTMP0, %%ZTMP1, %%ZTMP2, %%ZTMP3
;; load 4 plaintext blocks for lanes 12-15
LOAD_STORE_x4 12, 13, 14, 15, IN, %%IDX, %%B0L12_15, %%B1L12_15, \
%%B2L12_15, %%B3L12_15, %%TMP0, %%TMP1, LOAD, k1
TRANSPOSE_4x4 %%B0L12_15, %%B1L12_15, %%B2L12_15, %%B3L12_15, \
%%ZTMP0, %%ZTMP1, %%ZTMP2, %%ZTMP3
;; xor plaintext block with IV and round zero key
vpternlogq %%B0L00_03, %%ZIV00_03, R0_K0_3, 0x96
vpternlogq %%B0L04_07, %%ZIV04_07, R0_K4_7, 0x96
vpternlogq %%B0L08_11, %%ZIV08_11, R0_K8_11, 0x96
vpternlogq %%B0L12_15, %%ZIV12_15, [%%KP + %%K12_15_OFFSET], 0x96
;; encrypt block 0 lanes
AESENC_ROUNDS_x16 %%B0L00_03, %%B0L04_07, %%B0L08_11, %%B0L12_15, %%KP, %%NROUNDS
%if %%NUM_BLKS == 1
;; store last cipher block
vmovdqa64 %%ZIV00_03, %%B0L00_03
vmovdqa64 %%ZIV04_07, %%B0L04_07
vmovdqa64 %%ZIV08_11, %%B0L08_11
vmovdqa64 %%ZIV12_15, %%B0L12_15
%endif
%if %%NUM_BLKS >= 2
;; xor plaintext block with last cipher block and round zero key
vpternlogq %%B1L00_03, %%B0L00_03, R0_K0_3, 0x96
vpternlogq %%B1L04_07, %%B0L04_07, R0_K4_7, 0x96
vpternlogq %%B1L08_11, %%B0L08_11, R0_K8_11, 0x96
vpternlogq %%B1L12_15, %%B0L12_15, [%%KP + %%K12_15_OFFSET], 0x96
;; encrypt block 1 lanes
AESENC_ROUNDS_x16 %%B1L00_03, %%B1L04_07, %%B1L08_11, %%B1L12_15, %%KP, %%NROUNDS
%endif
%if %%NUM_BLKS == 2
;; store last cipher block
vmovdqa64 %%ZIV00_03, %%B1L00_03
vmovdqa64 %%ZIV04_07, %%B1L04_07
vmovdqa64 %%ZIV08_11, %%B1L08_11
vmovdqa64 %%ZIV12_15, %%B1L12_15
%endif
%if %%NUM_BLKS >= 3
;; xor plaintext block with last cipher block and round zero key
vpternlogq %%B2L00_03, %%B1L00_03, R0_K0_3, 0x96
vpternlogq %%B2L04_07, %%B1L04_07, R0_K4_7, 0x96
vpternlogq %%B2L08_11, %%B1L08_11, R0_K8_11, 0x96
vpternlogq %%B2L12_15, %%B1L12_15, [%%KP + %%K12_15_OFFSET], 0x96
;; encrypt block 2 lanes
AESENC_ROUNDS_x16 %%B2L00_03, %%B2L04_07, %%B2L08_11, %%B2L12_15, %%KP, %%NROUNDS
%endif
%if %%NUM_BLKS == 3
;; store last cipher block
vmovdqa64 %%ZIV00_03, %%B2L00_03
vmovdqa64 %%ZIV04_07, %%B2L04_07
vmovdqa64 %%ZIV08_11, %%B2L08_11
vmovdqa64 %%ZIV12_15, %%B2L12_15
%endif
;; Don't write back ciphertext for CBC-MAC
%if %%MAC_TYPE == MAC_TYPE_NONE
;; write back cipher text for lanes 0-3
TRANSPOSE_4x4 %%B0L00_03, %%B1L00_03, %%B2L00_03, %%B3L00_03, \
%%ZTMP0, %%ZTMP1, %%ZTMP2, %%ZTMP3
LOAD_STORE_x4 0, 1, 2, 3, OUT, %%IDX, %%B0L00_03, %%B1L00_03, \
%%B2L00_03, %%B3L00_03, %%TMP0, %%TMP1, STORE, k1
;; write back cipher text for lanes 4-7
TRANSPOSE_4x4 %%B0L04_07, %%B1L04_07, %%B2L04_07, %%B3L04_07, \
%%ZTMP0, %%ZTMP1, %%ZTMP2, %%ZTMP3
LOAD_STORE_x4 4, 5, 6, 7, OUT, %%IDX, %%B0L04_07, %%B1L04_07, \
%%B2L04_07, %%B3L04_07, %%TMP0, %%TMP1, STORE, k1
;; write back cipher text for lanes 8-11
TRANSPOSE_4x4 %%B0L08_11, %%B1L08_11, %%B2L08_11, %%B3L08_11, \
%%ZTMP0, %%ZTMP1, %%ZTMP2, %%ZTMP3
LOAD_STORE_x4 8, 9, 10, 11, OUT, %%IDX, %%B0L08_11, %%B1L08_11, \
%%B2L08_11, %%B3L08_11, %%TMP0, %%TMP1, STORE, k1
;; write back cipher text for lanes 12-15
TRANSPOSE_4x4 %%B0L12_15, %%B1L12_15, %%B2L12_15, %%B3L12_15, \
%%ZTMP0, %%ZTMP1, %%ZTMP2, %%ZTMP3
LOAD_STORE_x4 12, 13, 14, 15, OUT, %%IDX, %%B0L12_15, %%B1L12_15, \
%%B2L12_15, %%B3L12_15, %%TMP0, %%TMP1, STORE, k1
%endif ;; !CBC_MAC
;; update in/out pointers
mov %%IDX, %%NUM_BLKS
shl %%IDX, 4
vpbroadcastq %%ZTMP2, %%IDX
vpaddq %%ZTMP0, %%ZTMP2, [IN]
vpaddq %%ZTMP1, %%ZTMP2, [IN + 64]
vmovdqa64 [IN], %%ZTMP0
vmovdqa64 [IN + 64], %%ZTMP1
%if %%MAC_TYPE == MAC_TYPE_NONE ;; skip out pointer update for CBC_MAC/XCBC
vpaddq %%ZTMP0, %%ZTMP2, [OUT]
vpaddq %%ZTMP1, %%ZTMP2, [OUT + 64]
vmovdqa64 [OUT], %%ZTMP0
vmovdqa64 [OUT + 64], %%ZTMP1
%endif ;; MAC_TYPE
%endmacro
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; CBC_ENC Encodes given data.
; Requires the input data be at least 1 block (16 bytes) long
; Input: Number of AES rounds
;
; First encrypts block up to multiple of 4
; Then encrypts final blocks (less than 4)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
%macro CBC_ENC 2
%define %%ROUNDS %1
%define %%MAC_TYPE %2
%define %%K00_03_OFFSET 0
%define %%K04_07_OFFSET 64
%define %%K08_11_OFFSET 128
%if %%MAC_TYPE == MAC_TYPE_XCBC
%define %%KP ARG + _aes_xcbc_args_key_tab
%define %%IV ARG + _aes_xcbc_args_ICV
%define %%IN ARG + _aes_xcbc_args_in
%else
%define %%KP ARG + _aesarg_key_tab
%define %%IV ARG + _aesarg_IV
%define %%IN ARG + _aesarg_in
%define %%OUT ARG + _aesarg_out
%endif
;; load transpose tables
vmovdqa64 TAB_A0B0A1B1, [rel A0B0A1B1]
vmovdqa64 TAB_A2B2A3B3, [rel A2B2A3B3]
;; load IV's per lane
vmovdqa64 ZIV00_03, [%%IV + 16*0]
vmovdqa64 ZIV04_07, [%%IV + 16*4]
vmovdqa64 ZIV08_11, [%%IV + 16*8]
vmovdqa64 ZIV12_15, [%%IV + 16*12]
;; preload some input pointers
mov IN_L0, [%%IN + 8*0]
mov IN_L1, [%%IN + 8*1]
mov IN_L2, [%%IN + 8*2]
mov IN_L3, [%%IN + 8*3]
mov IN_L8, [%%IN + 8*8]
mov IN_L9, [%%IN + 8*9]
mov IN_L10, [%%IN + 8*10]
mov IN_L11, [%%IN + 8*11]
lea IN, [%%IN]
%if %%MAC_TYPE == MAC_TYPE_NONE
lea OUT, [%%OUT]
%endif
;; preload some round keys
vmovdqu64 R0_K0_3, [%%KP + %%K00_03_OFFSET]
vmovdqu64 R0_K4_7, [%%KP + %%K04_07_OFFSET]
vmovdqu64 R0_K8_11,[%%KP + %%K08_11_OFFSET]
vmovdqu64 R2_K0_3, [%%KP + %%K00_03_OFFSET + 2 * (16*16)]
vmovdqu64 R2_K4_7, [%%KP + %%K04_07_OFFSET + 2 * (16*16)]
vmovdqu64 R2_K8_11,[%%KP + %%K08_11_OFFSET + 2 * (16*16)]
ENCRYPT_16_PARALLEL ZIV00_03, ZIV04_07, ZIV08_11, ZIV12_15, \
LEN, %%ROUNDS, IA0, ZT0, ZT1, ZT2, ZT3, ZT4, ZT5, \
ZT6, ZT7, ZT8, ZT9, ZT10, ZT11, ZT12, ZT13, ZT14, \
ZT15, ZT16, ZT17, ZT18, ZT19, IA1, IA2, %%MAC_TYPE
;; get num remaining blocks
shr LEN, 4
and LEN, 3
je %%_cbc_enc_done
cmp LEN, 1
je %%_final_blocks_1
cmp LEN, 2
je %%_final_blocks_2
%%_final_blocks_3:
ENCRYPT_16_FINAL ZIV00_03, ZIV04_07, ZIV08_11, ZIV12_15, \
%%ROUNDS, IA0, ZT0, ZT1, ZT2, ZT3, ZT4, ZT5, ZT6, ZT7, \
ZT8, ZT9, ZT10, ZT11, ZT12, ZT13, ZT14, ZT15, ZT16, ZT17, \
ZT18, ZT19, IA1, IA2, 3, %%MAC_TYPE
jmp %%_cbc_enc_done
%%_final_blocks_1:
ENCRYPT_16_FINAL ZIV00_03, ZIV04_07, ZIV08_11, ZIV12_15, \
%%ROUNDS, IA0, ZT0, ZT1, ZT2, ZT3, ZT4, ZT5, ZT6, ZT7, \
ZT8, ZT9, ZT10, ZT11, ZT12, ZT13, ZT14, ZT15, ZT16, ZT17, \
ZT18, ZT19, IA1, IA2, 1, %%MAC_TYPE
jmp %%_cbc_enc_done
%%_final_blocks_2:
ENCRYPT_16_FINAL ZIV00_03, ZIV04_07, ZIV08_11, ZIV12_15, \
%%ROUNDS, IA0, ZT0, ZT1, ZT2, ZT3, ZT4, ZT5, ZT6, ZT7, \
ZT8, ZT9, ZT10, ZT11, ZT12, ZT13, ZT14, ZT15, ZT16, ZT17, \
ZT18, ZT19, IA1, IA2, 2, %%MAC_TYPE
%%_cbc_enc_done:
;; store IV's per lane
vmovdqa64 [%%IV + 16*0], ZIV00_03
vmovdqa64 [%%IV + 16*4], ZIV04_07
vmovdqa64 [%%IV + 16*8], ZIV08_11
vmovdqa64 [%%IV + 16*12], ZIV12_15
%endmacro
mksection .rodata
;;;;;;;;;;;;;;;;;;
; Transpose tables
;;;;;;;;;;;;;;;;;;
default rel
align 64
A0B0A1B1:
dq 0x0, 0x1, 0x8, 0x9, 0x2, 0x3, 0xa, 0xb
align 64
A2B2A3B3:
dq 0x4, 0x5, 0xc, 0xd, 0x6, 0x7, 0xe, 0xf
mksection .text
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; void aes_cbc_enc_128_vaes_avx512(AES_ARGS *args, uint64_t len_in_bytes);
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
MKGLOBAL(aes_cbc_enc_128_vaes_avx512,function,internal)
aes_cbc_enc_128_vaes_avx512:
endbranch64
FUNC_SAVE
CBC_ENC 9, MAC_TYPE_NONE
FUNC_RESTORE
%ifdef SAFE_DATA
clear_all_zmms_asm
%endif ;; SAFE_DATA
ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; void aes_cbc_enc_192_vaes_avx512(AES_ARGS *args, uint64_t len_in_bytes);
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
MKGLOBAL(aes_cbc_enc_192_vaes_avx512,function,internal)
aes_cbc_enc_192_vaes_avx512:
endbranch64
FUNC_SAVE
CBC_ENC 11, MAC_TYPE_NONE
FUNC_RESTORE
%ifdef SAFE_DATA
clear_all_zmms_asm
%endif ;; SAFE_DATA
ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; void aes_cbc_enc_256_vaes_avx512(AES_ARGS *args, uint64_t len_in_bytes);
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
MKGLOBAL(aes_cbc_enc_256_vaes_avx512,function,internal)
aes_cbc_enc_256_vaes_avx512:
endbranch64
FUNC_SAVE
CBC_ENC 13, MAC_TYPE_NONE
FUNC_RESTORE
ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; void aes128_cbc_mac_vaes_avx512(AES_ARGS *args, uint64_t len_in_bytes);
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
MKGLOBAL(aes128_cbc_mac_vaes_avx512,function,internal)
aes128_cbc_mac_vaes_avx512:
endbranch64
FUNC_SAVE
CBC_ENC 9, MAC_TYPE_CBC
FUNC_RESTORE
%ifdef SAFE_DATA
clear_all_zmms_asm
%endif ;; SAFE_DATA
ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; void aes256_cbc_mac_vaes_avx512(AES_ARGS *args, uint64_t len_in_bytes);
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
MKGLOBAL(aes256_cbc_mac_vaes_avx512,function,internal)
aes256_cbc_mac_vaes_avx512:
endbranch64
FUNC_SAVE
CBC_ENC 13, MAC_TYPE_CBC
FUNC_RESTORE
%ifdef SAFE_DATA
clear_all_zmms_asm
%endif ;; SAFE_DATA
ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; void aes_xcbc_mac_128_vaes_avx512(AES_XCBC_ARGS_x16 *args, uint64_t len_in_bytes);
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
MKGLOBAL(aes_xcbc_mac_128_vaes_avx512,function,internal)
aes_xcbc_mac_128_vaes_avx512:
endbranch64
FUNC_SAVE
CBC_ENC 9, MAC_TYPE_XCBC
FUNC_RESTORE
%ifdef SAFE_DATA
clear_all_zmms_asm
%endif ;; SAFE_DATA
ret
mksection stack-noexec
| 40.172489 | 89 | 0.540355 | [
"BSD-3-Clause"
] | clayne/intel-ipsec-mb | lib/avx512/aes_cbc_enc_vaes_avx512.asm | 36,798 | Assembly |
###############################################################################
# Copyright 2019 Intel Corporation
# All Rights Reserved.
#
# If this software was obtained under the Intel Simplified Software License,
# the following terms apply:
#
# The source code, information and material ("Material") contained herein is
# owned by Intel Corporation or its suppliers or licensors, and title to such
# Material remains with Intel Corporation or its suppliers or licensors. The
# Material contains proprietary information of Intel or its suppliers and
# licensors. The Material is protected by worldwide copyright laws and treaty
# provisions. No part of the Material may be used, copied, reproduced,
# modified, published, uploaded, posted, transmitted, distributed or disclosed
# in any way without Intel's prior express written permission. No license under
# any patent, copyright or other intellectual property rights in the Material
# is granted to or conferred upon you, either expressly, by implication,
# inducement, estoppel or otherwise. Any license under such intellectual
# property rights must be express and approved by Intel in writing.
#
# Unless otherwise agreed by Intel in writing, you may not remove or alter this
# notice or any other notice embedded in Materials by Intel or Intel's
# suppliers or licensors in any way.
#
#
# If this software was obtained under the Apache License, Version 2.0 (the
# "License"), the following terms apply:
#
# You may not use this file except in compliance with the License. You may
# obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#
# See the License for the specific language governing permissions and
# limitations under the License.
###############################################################################
.section .note.GNU-stack,"",%progbits
.text
.p2align 4, 0x90
.globl DecryptECB_RIJ128pipe_AES_NI
.type DecryptECB_RIJ128pipe_AES_NI, @function
DecryptECB_RIJ128pipe_AES_NI:
lea (,%rdx,4), %rax
movslq %r8d, %r8
sub $(64), %r8
jl .Lshort_inputgas_1
.Lblks_loopgas_1:
lea (%rcx,%rax,4), %r9
movdqa (%r9), %xmm4
sub $(16), %r9
movdqu (%rdi), %xmm0
movdqu (16)(%rdi), %xmm1
movdqu (32)(%rdi), %xmm2
movdqu (48)(%rdi), %xmm3
add $(64), %rdi
pxor %xmm4, %xmm0
pxor %xmm4, %xmm1
pxor %xmm4, %xmm2
pxor %xmm4, %xmm3
movdqa (%r9), %xmm4
sub $(16), %r9
mov %rdx, %r10
sub $(1), %r10
.Lcipher_loopgas_1:
aesdec %xmm4, %xmm0
aesdec %xmm4, %xmm1
aesdec %xmm4, %xmm2
aesdec %xmm4, %xmm3
movdqa (%r9), %xmm4
sub $(16), %r9
dec %r10
jnz .Lcipher_loopgas_1
aesdeclast %xmm4, %xmm0
movdqu %xmm0, (%rsi)
aesdeclast %xmm4, %xmm1
movdqu %xmm1, (16)(%rsi)
aesdeclast %xmm4, %xmm2
movdqu %xmm2, (32)(%rsi)
aesdeclast %xmm4, %xmm3
movdqu %xmm3, (48)(%rsi)
add $(64), %rsi
sub $(64), %r8
jge .Lblks_loopgas_1
.Lshort_inputgas_1:
add $(64), %r8
jz .Lquitgas_1
lea (%rcx,%rax,4), %r9
.p2align 4, 0x90
.Lsingle_blk_loopgas_1:
movdqu (%rdi), %xmm0
add $(16), %rdi
pxor (%r9), %xmm0
cmp $(12), %rdx
jl .Lkey_128_sgas_1
jz .Lkey_192_sgas_1
.Lkey_256_sgas_1:
aesdec (208)(%rcx), %xmm0
aesdec (192)(%rcx), %xmm0
.Lkey_192_sgas_1:
aesdec (176)(%rcx), %xmm0
aesdec (160)(%rcx), %xmm0
.Lkey_128_sgas_1:
aesdec (144)(%rcx), %xmm0
aesdec (128)(%rcx), %xmm0
aesdec (112)(%rcx), %xmm0
aesdec (96)(%rcx), %xmm0
aesdec (80)(%rcx), %xmm0
aesdec (64)(%rcx), %xmm0
aesdec (48)(%rcx), %xmm0
aesdec (32)(%rcx), %xmm0
aesdec (16)(%rcx), %xmm0
aesdeclast (%rcx), %xmm0
movdqu %xmm0, (%rsi)
add $(16), %rsi
sub $(16), %r8
jnz .Lsingle_blk_loopgas_1
.Lquitgas_1:
pxor %xmm4, %xmm4
ret
.Lfe1:
.size DecryptECB_RIJ128pipe_AES_NI, .Lfe1-(DecryptECB_RIJ128pipe_AES_NI)
| 35.413534 | 80 | 0.571338 | [
"Apache-2.0"
] | ymarkovitch/ipp-crypto | sources/ippcp/asm_intel64_gas_converted/linux/nonpic/y8/singlecpu/pcprij128decryptecbpipee9as.asm | 4,710 | Assembly |
; A170687: Number of reduced words of length n in Coxeter group on 6 generators S_i with relations (S_i)^2 = (S_i S_j)^50 = I.
; 1,6,30,150,750,3750,18750,93750,468750,2343750,11718750,58593750,292968750,1464843750,7324218750,36621093750,183105468750,915527343750,4577636718750,22888183593750,114440917968750,572204589843750,2861022949218750
mov $1,5
pow $1,$0
mul $1,6
div $1,5
| 47.5 | 214 | 0.794737 | [
"Apache-2.0"
] | jmorken/loda | programs/oeis/170/A170687.asm | 380 | Assembly |
; A001966: v-pile counts for the 4-Wythoff game with i=2.
; Submitted by Jamie Morken(w4)
; 2,7,13,18,23,28,34,39,44,49,54,60,65,70,75,81,86,91,96,102,107,112,117,123,128,133,138,143,149,154,159,164,170,175,180,185,191,196,201,206,212,217,222,227,233,238,243,248,253,259,264,269,274,280,285,290,295,301,306,311,316,322,327,332,337,342,348,353,358,363,369,374,379,384,390,395,400,405,411,416,421,426,431,437,442,447,452,458,463,468,473,479,484,489,494,500,505,510,515,520
mul $0,2
mov $1,$0
mul $0,2
seq $1,283233 ; 2*A000201.
add $1,$0
mov $0,$1
div $0,2
add $0,1
| 43.461538 | 380 | 0.704425 | [
"Apache-2.0"
] | ckrause/loda-programs | oeis/001/A001966.asm | 565 | Assembly |
include io.h
cr equ 10
lf equ 13
.model small
.stack 200h
.data
newline db cr,lf,0
str_in db 10 dup(?)
prompt db cr,lf,'insert string : ',0
.code
main proc
mov ax,@data
mov ds,ax
;-------------------------------------------
clrscr
output prompt
inputs str_in
mov si,offset str_in
mov di,offset str_in
fordi:
cmp byte ptr[di],0
je enddi
inc di
jmp fordi
enddi:
dec di
forin:
cmp si,di
jae endin
mov ah,[si]
mov al,[di]
mov [si],al
mov [di],ah
inc si
dec di
jmp forin
;--------------------------------------------
endin:
output newline
output str_in
;-----------------------------------------------------------------
mov ax,4c00h
int 21h
main endp
end main | 13.770492 | 69 | 0.435714 | [
"MIT"
] | amirshnll/assembly-exercises | exercises/res.asm | 840 | Assembly |
// check atomic
bneq r1 r0 .child //will not jump
lbi r19 1
slbi r19 0x0100 // r19 is at start pc
lbi r21 1
slbi r21 0x0400 // r21 is pointing to heap
addi r25 r21 2 // r25 = 0x10402
addi r7 r0 10
st r25 r7 0 // i: mem[0x10402] = 10
lbi r12 1
slbi r12 0xFF
.loop
ld r10 r25 0 //r10 = i
addi r10 r10 1 //r10 += 1
st r25 r10 0 //i = r10
blt r10 r12 .loop // jump if i < 0x100FF
shrt r10 r10 8 //r10 = 1
not r10 r10
shra r10 r10 8
st r0 r10 0 //0x0 : 0xFFFFFFFE
and r11 r10 r21 //r11 = heap start
ld r11 r11 2
st r0 r11 1 //0x1: i= 0x100ff
jal r8 0 //skip kill and jmp to next
beq r8 r0 -1
st r0 r8 2 //get current pc
.child
kill r1 // return | 18.684211 | 43 | 0.602817 | [
"MIT"
] | JPShen-UWM/ThreadKraken | sw/Demo/single_thread.asm | 710 | Assembly |
copyright zengfr site:http://github.com/zengfr/romhack
006216 move.w ($8,A3), ($14,A4) [boss+13, container+13, enemy+13]
00621C move.b ($a,A3), ($36,A4) [boss+14, container+14, enemy+14]
copyright zengfr site:http://github.com/zengfr/romhack
| 35.428571 | 67 | 0.701613 | [
"Apache-2.0"
] | zengfr/arcade_game_romhacking_sourcecode_top_secret_data | ffight/lcs/boss/14.asm | 248 | Assembly |
; A285197: Expansion of (1-6*x+11*x^2-5*x^3) / ((1-x)*(1-3*x)*(1-3*x+x^2)).
; Submitted by Jamie Morken(s1)
; 1,1,2,6,20,67,221,717,2294,7258,22760,70863,219353,675769,2073674,6342414,19345052,58867195,178779893,542042565,1641058046,4962262306,14989121072,45235277511,136407241265,411058035697,1237981634066,3726531171222,11212544793764,33723901952563,101397557291405,304783958604093,915899884568198,2751752393242474,8265867389585144,24825380058790719,74548863636620297,223836983400570025,672009404213589338,2017333182185696670,6055416001179996716,18175192397863781611,54548993921939812517
mov $2,1
mov $3,1
lpb $0
sub $0,1
add $2,$1
add $1,$3
add $1,$2
mul $3,3
lpe
mov $0,$2
div $0,2
add $0,1
| 41.529412 | 481 | 0.787535 | [
"Apache-2.0"
] | ckrause/loda-programs | oeis/285/A285197.asm | 706 | Assembly |
;;
;; Copyright (c) 2012-2020, Intel Corporation
;;
;; Redistribution and use in source and binary forms, with or without
;; modification, are permitted provided that the following conditions are met:
;;
;; * Redistributions of source code must retain the above copyright notice,
;; this list of conditions and the following disclaimer.
;; * Redistributions in binary form must reproduce the above copyright
;; notice, this list of conditions and the following disclaimer in the
;; documentation and/or other materials provided with the distribution.
;; * Neither the name of Intel Corporation nor the names of its contributors
;; may be used to endorse or promote products derived from this software
;; without specific prior written permission.
;;
;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
;; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
;; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
;; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
;; CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
;; OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
;; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;;
;;; routine to do 128 bit AES XCBC
;;; process 4 buffers at a time, single data structure as input
;;; Updates In pointer at end
;; clobbers all registers except for ARG1 and rbp
%include "include/os.asm"
%include "mb_mgr_datastruct.asm"
%include "include/clear_regs.asm"
%ifndef AES_XCBC_X4
%define AES_XCBC_X4 aes_xcbc_mac_128_x4
%endif
%define MOVDQ movdqu ;; assume buffers not aligned
%macro pxor2 2
MOVDQ XTMP, %2
pxor %1, XTMP
%endm
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; struct AES_XCBC_ARGS_x8 {
;; void* in[8];
;; UINT128* keys[8];
;; UINT128 ICV[8];
;; }
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; void aes_xcbc_mac_128_x4(AES_XCBC_ARGS_x8 *args, UINT64 len);
;; arg 1: ARG : addr of AES_XCBC_ARGS_x8 structure
;; arg 2: LEN : len (in units of bytes)
%ifdef LINUX
%define ARG rdi
%define LEN rsi
%define REG3 rcx
%define REG4 rdx
%else
%define ARG rcx
%define LEN rdx
%define REG3 rsi
%define REG4 rdi
%endif
%define IDX rax
%define IN0 r8
%define KEYS0 rbx
%define OUT0 r9
%define IN1 r10
%define KEYS1 REG3
%define OUT1 r11
%define IN2 r12
%define KEYS2 REG4
%define OUT2 r13
%define IN3 r14
%define KEYS3 rbp
%define OUT3 r15
%define XDATA0 xmm0
%define XDATA1 xmm1
%define XDATA2 xmm2
%define XDATA3 xmm3
%define XKEY0_3 xmm4
%define XKEY0_6 [KEYS0 + 16*6]
%define XTMP xmm5
%define XKEY0_9 xmm6
%define XKEY1_3 xmm7
%define XKEY1_6 xmm8
%define XKEY1_9 xmm9
%define XKEY2_3 xmm10
%define XKEY2_6 xmm11
%define XKEY2_9 xmm12
%define XKEY3_3 xmm13
%define XKEY3_6 xmm14
%define XKEY3_9 xmm15
section .text
MKGLOBAL(AES_XCBC_X4,function,internal)
AES_XCBC_X4:
push rbp
mov IDX, 16
mov IN0, [ARG + _aesxcbcarg_in + 8*0]
mov IN1, [ARG + _aesxcbcarg_in + 8*1]
mov IN2, [ARG + _aesxcbcarg_in + 8*2]
mov IN3, [ARG + _aesxcbcarg_in + 8*3]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
MOVDQ XDATA0, [IN0] ; load first block of plain text
MOVDQ XDATA1, [IN1] ; load first block of plain text
MOVDQ XDATA2, [IN2] ; load first block of plain text
MOVDQ XDATA3, [IN3] ; load first block of plain text
mov KEYS0, [ARG + _aesxcbcarg_keys + 8*0]
mov KEYS1, [ARG + _aesxcbcarg_keys + 8*1]
mov KEYS2, [ARG + _aesxcbcarg_keys + 8*2]
mov KEYS3, [ARG + _aesxcbcarg_keys + 8*3]
pxor XDATA0, [ARG + _aesxcbcarg_ICV + 16*0] ; plaintext XOR ICV
pxor XDATA1, [ARG + _aesxcbcarg_ICV + 16*1] ; plaintext XOR ICV
pxor XDATA2, [ARG + _aesxcbcarg_ICV + 16*2] ; plaintext XOR ICV
pxor XDATA3, [ARG + _aesxcbcarg_ICV + 16*3] ; plaintext XOR ICV
pxor XDATA0, [KEYS0 + 16*0] ; 0. ARK
pxor XDATA1, [KEYS1 + 16*0] ; 0. ARK
pxor XDATA2, [KEYS2 + 16*0] ; 0. ARK
pxor XDATA3, [KEYS3 + 16*0] ; 0. ARK
aesenc XDATA0, [KEYS0 + 16*1] ; 1. ENC
aesenc XDATA1, [KEYS1 + 16*1] ; 1. ENC
aesenc XDATA2, [KEYS2 + 16*1] ; 1. ENC
aesenc XDATA3, [KEYS3 + 16*1] ; 1. ENC
aesenc XDATA0, [KEYS0 + 16*2] ; 2. ENC
aesenc XDATA1, [KEYS1 + 16*2] ; 2. ENC
aesenc XDATA2, [KEYS2 + 16*2] ; 2. ENC
aesenc XDATA3, [KEYS3 + 16*2] ; 2. ENC
movdqa XKEY0_3, [KEYS0 + 16*3] ; load round 3 key
movdqa XKEY1_3, [KEYS1 + 16*3] ; load round 3 key
movdqa XKEY2_3, [KEYS2 + 16*3] ; load round 3 key
movdqa XKEY3_3, [KEYS3 + 16*3] ; load round 3 key
aesenc XDATA0, XKEY0_3 ; 3. ENC
aesenc XDATA1, XKEY1_3 ; 3. ENC
aesenc XDATA2, XKEY2_3 ; 3. ENC
aesenc XDATA3, XKEY3_3 ; 3. ENC
aesenc XDATA0, [KEYS0 + 16*4] ; 4. ENC
aesenc XDATA1, [KEYS1 + 16*4] ; 4. ENC
aesenc XDATA2, [KEYS2 + 16*4] ; 4. ENC
aesenc XDATA3, [KEYS3 + 16*4] ; 4. ENC
aesenc XDATA0, [KEYS0 + 16*5] ; 5. ENC
aesenc XDATA1, [KEYS1 + 16*5] ; 5. ENC
aesenc XDATA2, [KEYS2 + 16*5] ; 5. ENC
aesenc XDATA3, [KEYS3 + 16*5] ; 5. ENC
movdqa XKEY1_6, [KEYS1 + 16*6] ; load round 6 key
movdqa XKEY2_6, [KEYS2 + 16*6] ; load round 6 key
movdqa XKEY3_6, [KEYS3 + 16*6] ; load round 6 key
aesenc XDATA0, XKEY0_6 ; 6. ENC
aesenc XDATA1, XKEY1_6 ; 6. ENC
aesenc XDATA2, XKEY2_6 ; 6. ENC
aesenc XDATA3, XKEY3_6 ; 6. ENC
aesenc XDATA0, [KEYS0 + 16*7] ; 7. ENC
aesenc XDATA1, [KEYS1 + 16*7] ; 7. ENC
aesenc XDATA2, [KEYS2 + 16*7] ; 7. ENC
aesenc XDATA3, [KEYS3 + 16*7] ; 7. ENC
aesenc XDATA0, [KEYS0 + 16*8] ; 8. ENC
aesenc XDATA1, [KEYS1 + 16*8] ; 8. ENC
aesenc XDATA2, [KEYS2 + 16*8] ; 8. ENC
aesenc XDATA3, [KEYS3 + 16*8] ; 8. ENC
movdqa XKEY0_9, [KEYS0 + 16*9] ; load round 9 key
movdqa XKEY1_9, [KEYS1 + 16*9] ; load round 9 key
movdqa XKEY2_9, [KEYS2 + 16*9] ; load round 9 key
movdqa XKEY3_9, [KEYS3 + 16*9] ; load round 9 key
aesenc XDATA0, XKEY0_9 ; 9. ENC
aesenc XDATA1, XKEY1_9 ; 9. ENC
aesenc XDATA2, XKEY2_9 ; 9. ENC
aesenc XDATA3, XKEY3_9 ; 9. ENC
aesenclast XDATA0, [KEYS0 + 16*10] ; 10. ENC
aesenclast XDATA1, [KEYS1 + 16*10] ; 10. ENC
aesenclast XDATA2, [KEYS2 + 16*10] ; 10. ENC
aesenclast XDATA3, [KEYS3 + 16*10] ; 10. ENC
cmp LEN, IDX
je done
main_loop:
pxor2 XDATA0, [IN0 + IDX] ; plaintext XOR ICV
pxor2 XDATA1, [IN1 + IDX] ; plaintext XOR ICV
pxor2 XDATA2, [IN2 + IDX] ; plaintext XOR ICV
pxor2 XDATA3, [IN3 + IDX] ; plaintext XOR ICV
pxor XDATA0, [KEYS0 + 16*0] ; 0. ARK
pxor XDATA1, [KEYS1 + 16*0] ; 0. ARK
pxor XDATA2, [KEYS2 + 16*0] ; 0. ARK
pxor XDATA3, [KEYS3 + 16*0] ; 0. ARK
aesenc XDATA0, [KEYS0 + 16*1] ; 1. ENC
aesenc XDATA1, [KEYS1 + 16*1] ; 1. ENC
aesenc XDATA2, [KEYS2 + 16*1] ; 1. ENC
aesenc XDATA3, [KEYS3 + 16*1] ; 1. ENC
aesenc XDATA0, [KEYS0 + 16*2] ; 2. ENC
aesenc XDATA1, [KEYS1 + 16*2] ; 2. ENC
aesenc XDATA2, [KEYS2 + 16*2] ; 2. ENC
aesenc XDATA3, [KEYS3 + 16*2] ; 2. ENC
aesenc XDATA0, XKEY0_3 ; 3. ENC
aesenc XDATA1, XKEY1_3 ; 3. ENC
aesenc XDATA2, XKEY2_3 ; 3. ENC
aesenc XDATA3, XKEY3_3 ; 3. ENC
aesenc XDATA0, [KEYS0 + 16*4] ; 4. ENC
aesenc XDATA1, [KEYS1 + 16*4] ; 4. ENC
aesenc XDATA2, [KEYS2 + 16*4] ; 4. ENC
aesenc XDATA3, [KEYS3 + 16*4] ; 4. ENC
aesenc XDATA0, [KEYS0 + 16*5] ; 5. ENC
aesenc XDATA1, [KEYS1 + 16*5] ; 5. ENC
aesenc XDATA2, [KEYS2 + 16*5] ; 5. ENC
aesenc XDATA3, [KEYS3 + 16*5] ; 5. ENC
aesenc XDATA0, XKEY0_6 ; 6. ENC
aesenc XDATA1, XKEY1_6 ; 6. ENC
aesenc XDATA2, XKEY2_6 ; 6. ENC
aesenc XDATA3, XKEY3_6 ; 6. ENC
aesenc XDATA0, [KEYS0 + 16*7] ; 7. ENC
aesenc XDATA1, [KEYS1 + 16*7] ; 7. ENC
aesenc XDATA2, [KEYS2 + 16*7] ; 7. ENC
aesenc XDATA3, [KEYS3 + 16*7] ; 7. ENC
aesenc XDATA0, [KEYS0 + 16*8] ; 8. ENC
aesenc XDATA1, [KEYS1 + 16*8] ; 8. ENC
aesenc XDATA2, [KEYS2 + 16*8] ; 8. ENC
aesenc XDATA3, [KEYS3 + 16*8] ; 8. ENC
aesenc XDATA0, XKEY0_9 ; 9. ENC
aesenc XDATA1, XKEY1_9 ; 9. ENC
aesenc XDATA2, XKEY2_9 ; 9. ENC
aesenc XDATA3, XKEY3_9 ; 9. ENC
aesenclast XDATA0, [KEYS0 + 16*10] ; 10. ENC
aesenclast XDATA1, [KEYS1 + 16*10] ; 10. ENC
aesenclast XDATA2, [KEYS2 + 16*10] ; 10. ENC
aesenclast XDATA3, [KEYS3 + 16*10] ; 10. ENC
add IDX, 16
cmp LEN, IDX
jne main_loop
done:
;; update ICV
movdqa [ARG + _aesxcbcarg_ICV + 16*0], XDATA0
movdqa [ARG + _aesxcbcarg_ICV + 16*1], XDATA1
movdqa [ARG + _aesxcbcarg_ICV + 16*2], XDATA2
movdqa [ARG + _aesxcbcarg_ICV + 16*3], XDATA3
;; update IN
add IN0, LEN
mov [ARG + _aesxcbcarg_in + 8*0], IN0
add IN1, LEN
mov [ARG + _aesxcbcarg_in + 8*1], IN1
add IN2, LEN
mov [ARG + _aesxcbcarg_in + 8*2], IN2
add IN3, LEN
mov [ARG + _aesxcbcarg_in + 8*3], IN3
pop rbp
%ifdef SAFE_DATA
clear_all_xmms_sse_asm
%endif ;; SAFE_DATA
ret
%ifdef LINUX
section .note.GNU-stack noalloc noexec nowrite progbits
%endif
| 29.714286 | 81 | 0.65483 | [
"BSD-3-Clause"
] | kevintraynor/intel-ipsec-mb | sse/aes_xcbc_mac_128_x4.asm | 9,152 | Assembly |
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r14
push %r9
push %rbp
push %rdx
push %rsi
lea addresses_A_ht+0x1cbd9, %rdx
dec %rsi
mov $0x6162636465666768, %rbp
movq %rbp, %xmm5
vmovups %ymm5, (%rdx)
nop
add $53958, %rsi
lea addresses_WC_ht+0x119b5, %r14
nop
nop
nop
nop
add $5223, %r10
mov $0x6162636465666768, %r9
movq %r9, (%r14)
and $47184, %r10
lea addresses_WC_ht+0x1c5b5, %rdx
nop
nop
nop
nop
sub %r12, %r12
and $0xffffffffffffffc0, %rdx
vmovntdqa (%rdx), %ymm7
vextracti128 $0, %ymm7, %xmm7
vpextrq $1, %xmm7, %r9
nop
nop
nop
nop
nop
xor $61782, %rbp
lea addresses_A_ht+0x52f5, %r14
add $62262, %r9
vmovups (%r14), %ymm1
vextracti128 $0, %ymm1, %xmm1
vpextrq $0, %xmm1, %r12
nop
nop
nop
nop
nop
sub %r10, %r10
pop %rsi
pop %rdx
pop %rbp
pop %r9
pop %r14
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r15
push %r9
push %rbp
push %rbx
push %rcx
// Faulty Load
lea addresses_PSE+0x65b5, %rbp
nop
nop
nop
and $24948, %r9
mov (%rbp), %rcx
lea oracles, %r9
and $0xff, %rcx
shlq $12, %rcx
mov (%r9,%rcx,1), %rcx
pop %rcx
pop %rbx
pop %rbp
pop %r9
pop %r15
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_PSE', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_PSE', 'AVXalign': False, 'size': 8, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 2}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 10}}
{'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 32, 'NT': True, 'same': False, 'congruent': 11}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 6}, 'OP': 'LOAD'}
{'33': 21829}
33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33
*/
| 48.421569 | 2,999 | 0.661672 | [
"MIT"
] | danielmgmi/medusa | Transynther/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_1424.asm | 4,939 | Assembly |
; Aula 12 - SSE
; a12e05.asm
; Aritmética Packed de SP e DP
; nasm -f elf64 a12e05.asm ; gcc -m64 -no-pie a12e05.o -o a12e05.x
%define _exit 60
section .data
align 32, db 0
vetSP1 : dd 13.3, 14.4, 15.5, 16.6
vetSP2 : dd 3.3, 4.4, 5.5, 6.6
vetSPZ : dd 0, 0, 0, 0 ; desalinhou 32b
align 32, db 0
vetDP1 : dq 13.3, 14.4, 15.5, 16.6
vetDP2 : dq 3.3, 4.4, 5.5, 6.6
section .bss
alignb 32
vetRSPADD : resd 4
vetRSPMUL : resd 4
vetRDPSUB : resq 4
vetRDPDIV : resq 4
section .text
global main
main:
; stack-frame
push rbp
mov rbp, rsp
; 4-Packed ADD / MUL SP ===============================
MOVAPS xmm0, [vetSP1]
ADDPS xmm0, [vetSP2] ; gdb-tip: p $xmm0.v4_float
MOVAPS xmm1, [vetSP1]
MULPS xmm1, [vetSP2] ; gdb-tip: p $xmm1.v4_float
; 4-Packed SUB / DIV DP ===============================
VMOVAPS ymm2, [vetDP1]
VSUBPD ymm2, [vetDP2] ; gdb-tip: p $ymm2.v4_double
VMOVAPS ymm3, [vetDP1]
VDIVPD ymm3, [vetDP2] ; gdb-tip: p $ymm3.v4_double
; future trick-shot!
MOVAPS xmm5, [vetSP1]
hadd1:
HADDPS xmm5, [vetSP2] ; gdb-tip: p $xmm5.v4_float
hadd2:
HADDPS xmm5, [vetSPZ] ; gdb-tip: p $xmm5.v4_float
hadd3:
HADDPS xmm5, [vetSPZ] ; gdb-tip: p $xmm5.v4_float
fim:
; "destack-frame!"
mov rsp, rbp
pop rbp
mov rax, _exit
mov rdi, 0
syscall
| 21.378788 | 66 | 0.562721 | [
"MIT"
] | bellorini/unioeste | Etapa 02/Aula 12 - SSE/codes/a12e05.asm | 1,412 | Assembly |
SECTION code_fp_math32
PUBLIC ___fssub_callee
EXTERN cm32_sdcc_fssub_callee
defc ___fssub_callee = cm32_sdcc_fssub_callee
| 20 | 49 | 0.792857 | [
"BSD-2-Clause"
] | ByteProject/Puddle-BuildTools | FictionTools/z88dk/libsrc/_DEVELOPMENT/math/float/math32/lm32/c/sdcc/___fssub_callee.asm | 140 | Assembly |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Microsoft Research Singularity
;;;
;;; Copyright (c) Microsoft Corporation. All rights reserved.
;;;
;;; This file contains ARM-specific assembly code.
;;;
; normal.s
;
; Copyright (C) Advanced RISC Machines Limited, 1994. All rights reserved.
;
; RCS Revision: 1
; Checkin Date: 2007/06/29 02:59:16
; Revising Author
;===========================================================================
;Veneers onto the arith.s functions.
;
;This block should be assembled multiple times, once for each function.
;The possible functions are:
;
; normalise_s Normalisation functions
GBLL SinglePrecision
GBLL DoublePrecision
GBLL ExtendPrecision
GET fpe.asm
;===========================================================================
[ :DEF: thumb
CODE32
]
AREA |.text|, CODE, READONLY
EXPORT __fp_normalise_op1
EXPORT __fp_normalise_op2
EXPORT __fp_normalise_op1neg
EXPORT __fp_norm_denorm_op1
EXPORT __fp_norm_denorm_op2
GBLL normalise_s
SinglePrecision SETL {FALSE}
DoublePrecision SETL {FALSE}
ExtendPrecision SETL {FALSE}
normalise_s SETL {TRUE}
;===========================================================================
GET arith.asm
END
| 24.775862 | 98 | 0.501044 | [
"MIT"
] | pmache/singularityrdk | SOURCE/base/Kernel/Native/arm/Crt/normal.asm | 1,437 | Assembly |
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r13
push %r14
push %r9
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0x115e9, %rsi
lea addresses_WC_ht+0x3969, %rdi
nop
nop
nop
nop
nop
dec %r11
mov $49, %rcx
rep movsb
nop
nop
cmp %r11, %r11
lea addresses_WC_ht+0x196d1, %r14
nop
add $18282, %r9
mov (%r14), %eax
nop
nop
nop
nop
nop
add %rdi, %rdi
lea addresses_D_ht+0xb25, %rsi
lea addresses_D_ht+0x19431, %rdi
nop
nop
cmp %r13, %r13
mov $32, %rcx
rep movsw
nop
nop
xor %r11, %r11
lea addresses_WT_ht+0x112e9, %rcx
nop
nop
cmp $57061, %rax
mov (%rcx), %r14w
nop
and $15228, %r13
lea addresses_A_ht+0x17469, %rcx
nop
nop
nop
nop
cmp $43804, %rsi
mov $0x6162636465666768, %r9
movq %r9, %xmm6
vmovups %ymm6, (%rcx)
nop
nop
nop
nop
and $3778, %r14
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r14
pop %r13
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r12
push %rbp
push %rbx
// Faulty Load
lea addresses_normal+0xf969, %rbp
nop
nop
nop
dec %r12
mov (%rbp), %r10w
lea oracles, %r11
and $0xff, %r10
shlq $12, %r10
mov (%r11,%r10,1), %r10
pop %rbx
pop %rbp
pop %r12
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_normal', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_normal', 'AVXalign': False, 'size': 2, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_WC_ht', 'congruent': 5, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 10, 'same': False}}
{'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 2}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 2, 'same': False}}
{'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 6}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 8}}
{'34': 21829}
34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34
*/
| 44.396552 | 2,999 | 0.661748 | [
"MIT"
] | danielmgmi/medusa | Transynther/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_287.asm | 5,150 | Assembly |
<%
from pwnlib.shellcraft.mips.linux import syscall
%>
<%page args="sig, handler"/>
<%docstring>
Invokes the syscall signal. See 'man 2 signal' for more information.
Arguments:
sig(int): sig
handler(sighandler_t): handler
</%docstring>
${syscall('SYS_signal', sig, handler)}
| 21 | 69 | 0.690476 | [
"MIT"
] | IMULMUL/python3-pwntools | pwnlib/shellcraft/templates/mips/android/signal.asm | 294 | Assembly |
;// TI File $Revision: /main/4 $
;// Checkin $Date: July 30, 2007 10:28:57 $
;//###########################################################################
;//
;// FILE: DSP2833x_usDelay.asm
;//
;// TITLE: Simple delay function
;//
;// DESCRIPTION:
;//
;// This is a simple delay function that can be used to insert a specified
;// delay into code.
;//
;// This function is only accurate if executed from internal zero-waitstate
;// SARAM. If it is executed from waitstate memory then the delay will be
;// longer then specified.
;//
;// To use this function:
;//
;// 1 - update the CPU clock speed in the DSP2833x_Examples.h
;// file. For example:
;// #define CPU_RATE 6.667L // for a 150MHz CPU clock speed
;// or #define CPU_RATE 10.000L // for a 100MHz CPU clock speed
;//
;// 2 - Call this function by using the DELAY_US(A) macro
;// that is defined in the DSP2833x_Examples.h file. This macro
;// will convert the number of microseconds specified
;// into a loop count for use with this function.
;// This count will be based on the CPU frequency you specify.
;//
;// 3 - For the most accurate delay
;// - Execute this function in 0 waitstate RAM.
;// - Disable interrupts before calling the function
;// If you do not disable interrupts, then think of
;// this as an "at least" delay function as the actual
;// delay may be longer.
;//
;// The C assembly call from the DELAY_US(time) macro will
;// look as follows:
;//
;// extern void Delay(long LoopCount);
;//
;// MOV AL,#LowLoopCount
;// MOV AH,#HighLoopCount
;// LCR _Delay
;//
;// Or as follows (if count is less then 16-bits):
;//
;// MOV ACC,#LoopCount
;// LCR _Delay
;//
;//
;//###########################################################################
;// $TI Release: DSP2833x/DSP2823x C/C++ Header Files V1.31 $
;// $Release Date: August 4, 2009 $
;//###########################################################################
.def _DSP28x_usDelay
;// .sect "ramfuncs"
.global __DSP28x_usDelay
_DSP28x_usDelay:
SUB ACC,#1
BF _DSP28x_usDelay,GEQ ;; Loop if ACC >= 0
LRETR
;There is a 9/10 cycle overhead and each loop
;takes five cycles. The LoopCount is given by
;the following formula:
; DELAY_CPU_CYCLES = 9 + 5*LoopCount
; LoopCount = (DELAY_CPU_CYCLES - 9) / 5
; The macro DELAY_US(A) performs this calculation for you
;
;//===========================================================================
;// End of file.
;//===========================================================================
| 34.558442 | 79 | 0.541526 | [
"CC0-1.0"
] | zhanglongqi/CAN-on-DSP-TMS320F28335 | lib/DSP2833x_usDelay.asm | 2,661 | Assembly |
; A282413: Decimal representation of the x-axis, from the left edge to the origin, of the n-th stage of growth of the two-dimensional cellular automaton defined by "Rule 467", based on the 5-celled von Neumann neighborhood.
; 1,1,7,0,31,0,127,0,511,0,2047,0,8191,0,32767,0,131071,0,524287,0,2097151,0,8388607,0,33554431,0,134217727,0,536870911,0,2147483647,0,8589934591,0,34359738367,0,137438953471,0,549755813887,0,2199023255551,0,8796093022207,0,35184372088831,0,140737488355327,0,562949953421311,0,2251799813685247,0,9007199254740991,0,36028797018963967,0,144115188075855871,0,576460752303423487,0,2305843009213693951,0,9223372036854775807,0,36893488147419103231,0,147573952589676412927,0,590295810358705651711,0,2361183241434822606847,0,9444732965739290427391,0,37778931862957161709567,0,151115727451828646838271,0,604462909807314587353087,0,2417851639229258349412351,0,9671406556917033397649407,0,38685626227668133590597631,0,154742504910672534362390527,0,618970019642690137449562111,0,2475880078570760549798248447,0,9903520314283042199192993791,0,39614081257132168796771975167,0,158456325028528675187087900671,0,633825300114114700748351602687,0
mov $1,2
lpb $0
gcd $1,$0
add $0,1
pow $1,$0
gcd $0,2
lpe
sub $1,1
mov $0,$1
| 95.153846 | 926 | 0.843169 | [
"Apache-2.0"
] | ckrause/cm | programs/oeis/282/A282413.asm | 1,237 | Assembly |
; A192460: Constant term of the reduction by x^2->x+1 of the polynomial p(n,x) defined below in Comments.
; Submitted by Jamie Morken(w1)
; 0,2,13,123,1487,21871,378942,7557722,170519635,4293742365,119359055585,3630473717035,119930672906880,4275825418586810,163638018718726915,6690920298998362845,291099044600505086165,13426830426820884360265
mov $1,$0
mov $2,1
lpb $0
sub $0,1
add $3,$2
mov $4,$3
mul $3,$1
add $3,$2
add $2,$4
mul $2,$1
sub $1,1
add $2,$4
lpe
mov $0,$3
| 25.789474 | 204 | 0.72449 | [
"Apache-2.0"
] | ckrause/loda-programs | oeis/192/A192460.asm | 490 | Assembly |
; A070909: Triangle read by rows giving successive states of cellular automaton generated by "Rule 28" and by "Rule 156".
; 1,1,1,1,0,1,1,0,1,1,1,0,1,0,1,1,0,1,0,1,1,1,0,1,0,1,0,1,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0
lpb $0
mov $1,$0
sub $0,1
sub $0,$2
add $2,1
mod $1,$2
lpe
gcd $1,2
sub $1,1
mov $0,$1
| 30 | 199 | 0.57381 | [
"Apache-2.0"
] | ckrause/cm | programs/oeis/070/A070909.asm | 420 | Assembly |
; Flowchart Example (Flowchart.asm)
; Implements the flowchart in Figure 6-2,
; Calculates the sum of all array elements larger than
; a given value (sample).
INCLUDE Irvine32.inc
.data
sum DWORD 0
sample DWORD 50
array DWORD 10,60,20,33,72,89,45,65,72,18
ArraySize = ($ - Array) / TYPE array
.code
main PROC
mov eax,0 ; sum
mov edx,sample
mov esi,0 ; index
mov ecx,ArraySize
L1: cmp esi,ecx
jl L2
jmp L5
L2: cmp array[esi*4], edx
jg L3
jmp L4
L3: add eax,array[esi*4]
L4: inc esi
jmp L1
L5: mov sum,eax
call Writeint
call Crlf
exit
main ENDP
END main | 13.72093 | 54 | 0.686441 | [
"Apache-2.0"
] | alieonsido/ASM_TESTING | Irvine/Examples/ch06/32 bit/Flowchart.asm | 590 | Assembly |
; Konami VRC4e: (up to 256KB) PRG-ROM + (0,2,8)KB PRG-RAM + (up to 512KB) CHR-ROM
; http://bootgod.dyndns.org:7777/search.php?keywords=23&kwtype=pcb
;------------------------------------------------------------------------------;
; number of 16K PRG banks
PRG_BANKS = $04
; number of 8K CHR banks
; Valid values: $02 (16K), $04 (32K), $06 (64K), $08 (128K), $0A (256K), $0C (512K)
CHR_BANKS = $02
; VRC4 mirroring is mapper controlled. This just sets the default.
; If you want one-screen mirroring, you will need to set it via a write.
; %0000 = Horizontal
; %0001 = Vertical
MIRRORING = %0001
; xxx: PRG-RAM thing
; Mapper 023 (VRC4e) iNES header
.byte "NES",$1A
.byte PRG_BANKS ; 16K PRG banks
.byte CHR_BANKS ; 8K CHR banks
.byte $70|MIRRORING ; flags 6
.byte $10 ; flags 7
.byte $00 ; no PRG RAM
.dsb 7, $00 ; clear the remaining bytes
; VRC4e defines
; Registers: $x000, $x008, $x008, $x00C
VRC4_PRGModeSwap = $9008 ; ($9008,$900C)
VRC4_PRGSelect0 = $8000 ; ($8000,$8004,$8008,$800C)
VRC4_PRGSelect1 = $A000 ; ($A000,$A004,$A008,$A00C)
VRC4_Mirroring = $9000 ; ($9000,$9004)
VRC4_IRQControl = $F000 ; ($F000,$F004,$F008,$F00C)
;-----------------------------------------------------;
VRC4_CHRSel0_Lo = $B000 ; low 4 bits (PPU $0000)
VRC4_CHRSel0_Hi = $B004 ; high 5 bits (PPU $0000)
VRC4_CHRSel1_Lo = $B008 ; low 4 bits (PPU $0400)
VRC4_CHRSel1_Hi = $B00C ; high 5 bits (PPU $0400)
VRC4_CHRSel2_Lo = $C000 ; low 4 bits (PPU $0800)
VRC4_CHRSel2_Hi = $C004 ; high 5 bits (PPU $0800)
VRC4_CHRSel3_Lo = $C008 ; low 4 bits (PPU $0C00)
VRC4_CHRSel3_Hi = $C00C ; high 5 bits (PPU $0C00)
;-----------------------------------------------------;
VRC4_CHRSel4_Lo = $D000 ; low 4 bits (PPU $1000)
VRC4_CHRSel4_Hi = $D004 ; high 5 bits (PPU $1000)
VRC4_CHRSel5_Lo = $D008 ; low 4 bits (PPU $1400)
VRC4_CHRSel5_Hi = $D00C ; high 5 bits (PPU $1400)
VRC4_CHRSel6_Lo = $E000 ; low 4 bits (PPU $1800)
VRC4_CHRSel6_Hi = $E004 ; high 5 bits (PPU $1800)
VRC4_CHRSel7_Lo = $E008 ; low 4 bits (PPU $1C00)
VRC4_CHRSel7_Hi = $E00C ; high 5 bits (PPU $1C00)
| 39.056604 | 83 | 0.613527 | [
"Apache-2.0"
] | master-g/childhood | nes_corelib/header/023/VRC4e.asm | 2,070 | Assembly |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Copyright(c) 2011-2018 Intel Corporation All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions
; are met:
; * Redistributions of source code must retain the above copyright
; notice, this list of conditions and the following disclaimer.
; * Redistributions in binary form must reproduce the above copyright
; notice, this list of conditions and the following disclaimer in
; the documentation and/or other materials provided with the
; distribution.
; * Neither the name of Intel Corporation nor the names of its
; contributors may be used to endorse or promote products derived
; from this software without specific prior written permission.
;
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
; OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
%define GCM256_MODE 1
%include "sse/gcm_sse.asm"
| 55.65625 | 72 | 0.703537 | [
"BSD-3-Clause"
] | kevintraynor/intel-ipsec-mb | sse/gcm256_sse.asm | 1,781 | Assembly |
; A083744: a(1) = 1; if a(n-1) + n is composite then a(n) = a(n-1) + n, else a(n) = a(n-1).
; 1,1,4,8,8,14,21,21,30,40,51,63,76,90,105,121,138,156,175,195,216,238,261,285,310,336,363,391,420,450,481,513,546,580,615,651,688,726,765,805,846,888,931,975,1020,1066,1113,1161,1210,1260,1311,1363,1416,1470,1525,1581,1638,1696,1755,1815,1876,1938,2001,2065,2130,2196,2263,2331,2400,2470,2541,2613,2686,2760,2835,2911,2988,3066,3145,3225,3306,3388,3471,3555,3640,3726,3813,3901,3990,4080,4171,4263,4356,4450,4545,4641,4738,4836,4935,5035,5136,5238,5341,5445,5550,5656,5763,5871,5980,6090,6201,6313,6426,6540,6655,6771,6888,7006,7125,7245,7366,7488,7611,7735,7860,7986,8113,8241,8370,8500,8631,8763,8896,9030,9165,9301,9438,9576,9715,9855,9996,10138,10281,10425,10570,10716,10863,11011,11160,11310,11461,11613,11766,11920,12075,12231,12388,12546,12705,12865,13026,13188,13351,13515,13680,13846,14013,14181,14350,14520,14691,14863,15036,15210,15385,15561,15738,15916,16095,16275,16456,16638,16821,17005,17190,17376,17563,17751,17940,18130,18321,18513,18706,18900,19095,19291,19488,19686,19885,20085,20286,20488,20691,20895,21100,21306,21513,21721,21930,22140,22351,22563,22776,22990,23205,23421,23638,23856,24075,24295,24516,24738,24961,25185,25410,25636,25863,26091,26320,26550,26781,27013,27246,27480,27715,27951,28188,28426,28665,28905,29146,29388,29631,29875,30120,30366,30613,30861,31110,31360
mov $3,$0
mov $8,$0
add $8,1
lpb $8,1
mov $0,$3
sub $8,1
sub $0,$8
add $0,2
mov $2,3
mov $5,$0
mov $6,0
add $6,$0
add $0,1
lpb $0,1
add $0,1
gcd $2,$5
mov $4,$2
mul $4,2
sub $0,$4
mul $0,2
sub $0,1
mov $6,1
lpe
mov $7,$6
sub $7,1
add $1,$7
lpe
| 54.677419 | 1,297 | 0.721534 | [
"Apache-2.0"
] | karttu/loda | programs/oeis/083/A083744.asm | 1,695 | Assembly |
; A169622: a(n) = a(n-1) + Fibonacci(n), a(1)=5.
; 5,6,8,11,16,24,37,58,92,147,236,380,613,990,1600,2587,4184,6768,10949,17714,28660,46371,75028,121396,196421,317814,514232,832043,1346272,2178312,3524581,5702890,9227468,14930355,24157820,39088172,63245989,102334158,165580144,267914299,433494440,701408736,1134903173,1836311906,2971215076,4807526979,7778742052,12586269028,20365011077,32951280102,53316291176,86267571275,139583862448,225851433720,365435296165,591286729882,956722026044,1548008755923,2504730781964,4052739537884,6557470319845,10610209857726,17167680177568,27777890035291,44945570212856,72723460248144,117669030460997,190392490709138,308061521170132,498454011879267,806515533049396,1304969544928660,2111485077978053,3416454622906710,5527939700884760,8944394323791467
mov $1,2
mov $2,1
lpb $0,1
sub $0,1
mov $3,$2
mov $2,$1
add $1,$3
lpe
add $1,3
| 66.923077 | 732 | 0.831034 | [
"Apache-2.0"
] | karttu/loda | programs/oeis/169/A169622.asm | 870 | Assembly |
; int scanf_unlocked(const char *format, ...)
SECTION code_clib
SECTION code_stdio
PUBLIC _scanf_unlocked
EXTERN asm_scanf_unlocked
_scanf_unlocked:
push ix
call asm_scanf_unlocked
pop ix
ret
| 11.473684 | 45 | 0.738532 | [
"BSD-2-Clause"
] | ByteProject/Puddle-BuildTools | FictionTools/z88dk/libsrc/_DEVELOPMENT/stdio/c/sdcc_ix/scanf_unlocked.asm | 218 | Assembly |
; A265021: Sum of fifth powers of the first n even numbers.
; 0,32,1056,8832,41600,141600,390432,928256,1976832,3866400,7066400,12220032,20182656,32064032,49274400,73574400,107128832,152564256,213030432,292265600,394665600,525356832,690273056,896236032,1151040000,1463540000,1843744032,2302909056,2853640832,3509997600,4287597600,5203730432,6277472256,7529804832,8983738400,10664438400,12599356032,14818362656,17353888032,20241062400,23517862400,27225260832,31407380256,36111650432,41388969600,47293869600,53884684832,61223725056,69377452032,78416660000
mov $1,$0
pow $0,2
add $1,$0
mov $0,2
mul $0,$1
bin $0,2
mul $1,$0
mov $0,$1
div $0,12
mul $0,32
| 46.571429 | 493 | 0.826687 | [
"Apache-2.0"
] | ckrause/loda-programs | oeis/265/A265021.asm | 652 | Assembly |
; A120785: Denominators of partial sums of Catalan numbers scaled by powers of 1/16.
; 1,16,128,4096,32768,524288,4194304,268435456,2147483648,34359738368,274877906944,8796093022208,70368744177664,1125899906842624,9007199254740992,1152921504606846976
mul $0,2
add $0,2
seq $0,46161 ; a(n) = denominator of binomial(2n,n)/4^n.
div $0,8
| 42 | 165 | 0.794643 | [
"Apache-2.0"
] | ckrause/cm | programs/oeis/120/A120785.asm | 336 | Assembly |
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r12
push %r13
push %r9
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0x1935d, %r11
nop
nop
nop
dec %r9
mov $0x6162636465666768, %r13
movq %r13, %xmm1
movups %xmm1, (%r11)
nop
inc %r12
lea addresses_D_ht+0x1c87d, %rsi
lea addresses_D_ht+0x6ced, %rdi
nop
nop
cmp %r10, %r10
mov $107, %rcx
rep movsw
nop
nop
nop
nop
nop
sub $8048, %r11
lea addresses_D_ht+0x16a7d, %r11
clflush (%r11)
nop
nop
nop
nop
nop
and $21822, %rdi
movl $0x61626364, (%r11)
nop
nop
nop
nop
inc %rcx
lea addresses_D_ht+0x14a55, %rcx
nop
xor $53938, %r10
movw $0x6162, (%rcx)
nop
nop
nop
sub %rsi, %rsi
lea addresses_normal_ht+0xea7d, %r11
nop
nop
add %rdi, %rdi
movb $0x61, (%r11)
nop
nop
nop
nop
nop
add %rsi, %rsi
lea addresses_WT_ht+0xe47d, %rdi
clflush (%rdi)
nop
nop
nop
nop
nop
sub $63183, %r12
mov (%rdi), %r9w
nop
nop
nop
xor $57279, %r13
lea addresses_A_ht+0x11415, %rsi
lea addresses_UC_ht+0x113ca, %rdi
nop
nop
nop
nop
dec %r9
mov $61, %rcx
rep movsl
add $61387, %r10
lea addresses_D_ht+0x1e97d, %r12
nop
nop
nop
dec %rdi
mov (%r12), %esi
nop
nop
nop
nop
and %rsi, %rsi
lea addresses_normal_ht+0xb9b5, %rsi
lea addresses_A_ht+0x15b7d, %rdi
nop
nop
nop
nop
nop
sub %r12, %r12
mov $51, %rcx
rep movsb
dec %rcx
lea addresses_WC_ht+0x8afd, %rsi
lea addresses_WT_ht+0x7421, %rdi
nop
nop
xor %r9, %r9
mov $8, %rcx
rep movsb
nop
nop
nop
nop
and %rdi, %rdi
lea addresses_UC_ht+0x4f85, %rsi
lea addresses_normal_ht+0x1dd7d, %rdi
nop
cmp %r9, %r9
mov $77, %rcx
rep movsb
nop
nop
nop
sub %r10, %r10
lea addresses_WC_ht+0x12bf9, %r13
nop
nop
nop
dec %rcx
movups (%r13), %xmm3
vpextrq $0, %xmm3, %rsi
nop
nop
nop
nop
and %r13, %r13
lea addresses_WC_ht+0x3fbd, %rsi
lea addresses_D_ht+0xe87d, %rdi
nop
nop
mfence
mov $69, %rcx
rep movsl
inc %r9
lea addresses_WC_ht+0x8a7d, %rsi
lea addresses_D_ht+0x1cbf5, %rdi
nop
nop
add $5629, %r11
mov $35, %rcx
rep movsl
nop
nop
cmp $40364, %r11
pop %rsi
pop %rdi
pop %rcx
pop %r9
pop %r13
pop %r12
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r14
push %r8
push %r9
push %rax
push %rbx
// Store
lea addresses_normal+0xdc0d, %r9
nop
nop
nop
and %r8, %r8
movl $0x51525354, (%r9)
nop
nop
nop
nop
cmp $45387, %r12
// Store
lea addresses_PSE+0xc37d, %rax
add %r9, %r9
mov $0x5152535455565758, %r12
movq %r12, %xmm5
vmovaps %ymm5, (%rax)
add $52241, %rax
// Store
mov $0x76ab4d0000000575, %r14
nop
nop
nop
nop
nop
sub %r10, %r10
movl $0x51525354, (%r14)
nop
nop
nop
inc %rax
// Store
lea addresses_A+0x7c7d, %r8
clflush (%r8)
nop
nop
nop
sub $15059, %r9
movl $0x51525354, (%r8)
nop
nop
nop
add $6437, %rax
// Faulty Load
lea addresses_UC+0x1827d, %r9
nop
and $48604, %r14
vmovntdqa (%r9), %ymm6
vextracti128 $1, %ymm6, %xmm6
vpextrq $0, %xmm6, %rax
lea oracles, %r14
and $0xff, %rax
shlq $12, %rax
mov (%r14,%rax,1), %rax
pop %rbx
pop %rax
pop %r9
pop %r8
pop %r14
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'congruent': 0, 'AVXalign': True, 'same': True, 'size': 32, 'NT': False, 'type': 'addresses_UC'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 4, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_normal'}}
{'OP': 'STOR', 'dst': {'congruent': 4, 'AVXalign': True, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_PSE'}}
{'OP': 'STOR', 'dst': {'congruent': 3, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_NC'}}
{'OP': 'STOR', 'dst': {'congruent': 7, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_A'}}
[Faulty Load]
{'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 32, 'NT': True, 'type': 'addresses_UC'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'congruent': 5, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_D_ht'}}
{'src': {'congruent': 9, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'congruent': 2, 'same': False, 'type': 'addresses_D_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 11, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_D_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 3, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_D_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 10, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_normal_ht'}}
{'src': {'congruent': 6, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 3, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'congruent': 0, 'same': False, 'type': 'addresses_UC_ht'}}
{'src': {'congruent': 8, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 3, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'congruent': 8, 'same': False, 'type': 'addresses_A_ht'}}
{'src': {'congruent': 6, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 2, 'same': False, 'type': 'addresses_WT_ht'}}
{'src': {'congruent': 2, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 8, 'same': False, 'type': 'addresses_normal_ht'}}
{'src': {'congruent': 2, 'AVXalign': False, 'same': True, 'size': 16, 'NT': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 6, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 9, 'same': False, 'type': 'addresses_D_ht'}}
{'src': {'congruent': 11, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 3, 'same': False, 'type': 'addresses_D_ht'}}
{'46': 12, '00': 151, '48': 880, '45': 20786}
45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 48 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 48 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 48 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 48 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 48 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 48 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 48 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 48 45 45 45 45 48 00 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 45 45 45 45 45 45 48 45 45 48 45 45 45 45 45 45 45 45 45 45 45 45 45 45 48 45 45 45 45 45 45 48 45 48 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 45 48 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 48 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 48 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 48 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 48 45 45 48 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 48 45 45 45 45 45 45 45 45 48 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 48 45 45 45 45 45 45 45 45 45 45 45 45 48 45 45 48 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 48 45 45 45 45 45 45 45 45 45 48 45 45 45 45 48 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 00 45 45 45 45 48 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 48 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 48 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 48 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 48 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 48 45 45 45 45 45 45
*/
| 30.992857 | 2,999 | 0.655912 | [
"MIT"
] | danielmgmi/medusa | Transynther/_processed/AVXALIGN/_ht_zr_/i7-7700_9_0xca.log_21829_1835.asm | 8,678 | Assembly |
; A111074: Let t(n) denote the triangular numbers (A000217). Sequence mixes t(n+2) and t(n).
; 3,0,6,1,10,3,15,6,21,10,28,15,36,21,45,28,55,36,66,45,78,55,91,66,105,78,120,91,136,105,153,120,171,136,190,153,210,171,231,190,253,210,276,231,300,253,325,276,351,300,378,325,406,351,435,378,465,406,496,435
mov $3,$0
gcd $0,8
mov $5,$3
add $5,3
mov $2,$5
mov $4,3
lpb $0
mov $0,1
add $2,$4
add $2,2
lpe
sub $2,3
pow $2,2
add $1,$2
div $1,8
| 23.315789 | 209 | 0.645598 | [
"Apache-2.0"
] | jmorken/loda | programs/oeis/111/A111074.asm | 443 | Assembly |
;; @file
; This file provides assembly 64-bit atomic reads/writes required for memory initialization.
;
; Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent
;
;;
.686p
.xmm
.model small, c
.CODE
;-----------------------------------------------------------------------------
;
; Section: SaMmioRead64
;
; Description: Read 64 bits from the Memory Mapped I/O space.
; Use MMX instruction for atomic access, because some MC registers have side effect.
;
; @param[in] Address - Memory mapped I/O address.
;
;-----------------------------------------------------------------------------
;UINT64
;SaMmioRead64 (
; IN UINTN Address
; )
SaMmioRead64 PROC NEAR PUBLIC
sub esp, 16
movq [esp], mm0 ;Save mm0 on stack
mov edx, [esp + 20] ;edx = Address
movq mm0, [edx] ;mm0 = [Address]
movq [esp + 8], mm0 ;Store mm0 on Stack
movq mm0, [esp] ;Restore mm0
emms
mov eax, [esp + 8] ;eax = [Address][31:0]
mov edx, [esp + 12] ;edx = [Address][64:32]
add esp, 16
ret
SaMmioRead64 ENDP
;-----------------------------------------------------------------------------
;
; Section: SaMmioWrite64
;
; Description: Write 64 bits to the Memory Mapped I/O space.
; Use MMX instruction for atomic access, because some MC registers have side effect.
;
; @param[in] Address - Memory mapped I/O address.
; @param[in] Value - The value to write.
;
;-----------------------------------------------------------------------------
;UINT64
;SaMmioWrite64 (
; IN UINTN Address,
; IN UINT64 Value
; )
SaMmioWrite64 PROC NEAR PUBLIC
sub esp, 8
movq [esp], mm0 ;Save mm0 on Stack
mov edx, [esp + 12] ;edx = Address
movq mm0, [esp + 16] ;mm0 = Value
movq [edx], mm0 ;[Address] = Value
movq mm0, [esp] ;Restore mm0
emms
mov eax, [esp + 16] ;eax = Value[31:0]
mov edx, [esp + 20] ;edx = Value[64:32]
add esp, 8
ret
SaMmioWrite64 ENDP
end
| 27.575 | 94 | 0.487761 | [
"Apache-2.0"
] | S-8506/edk2msm | edk2-platforms/Silicon/Intel/KabylakeSiliconPkg/SystemAgent/Library/PeiSaPolicyLib/Ia32/MrcOemPlatform.asm | 2,206 | Assembly |
OPTION DOTNAME
.text$ SEGMENT ALIGN(256) 'CODE'
EXTERN BLS12_381_P:NEAR
PUBLIC add_mod_384
ALIGN 32
add_mod_384 PROC PUBLIC
DB 243,15,30,250
mov QWORD PTR[8+rsp],rdi ;WIN64 prologue
mov QWORD PTR[16+rsp],rsi
mov r11,rsp
$L$SEH_begin_add_mod_384::
mov rdi,rcx
mov rsi,rdx
mov rdx,r8
mov rcx,r9
push rbp
push rbx
push r12
push r13
push r14
push r15
sub rsp,8
$L$SEH_body_add_mod_384::
call __add_mod_384
mov r15,QWORD PTR[8+rsp]
mov r14,QWORD PTR[16+rsp]
mov r13,QWORD PTR[24+rsp]
mov r12,QWORD PTR[32+rsp]
mov rbx,QWORD PTR[40+rsp]
mov rbp,QWORD PTR[48+rsp]
lea rsp,QWORD PTR[56+rsp]
$L$SEH_epilogue_add_mod_384::
mov rdi,QWORD PTR[8+rsp] ;WIN64 epilogue
mov rsi,QWORD PTR[16+rsp]
DB 0F3h,0C3h ;repret
$L$SEH_end_add_mod_384::
add_mod_384 ENDP
ALIGN 32
__add_mod_384 PROC PRIVATE
DB 243,15,30,250
mov r8,QWORD PTR[rsi]
mov r9,QWORD PTR[8+rsi]
mov r10,QWORD PTR[16+rsi]
mov r11,QWORD PTR[24+rsi]
mov r12,QWORD PTR[32+rsi]
mov r13,QWORD PTR[40+rsi]
__add_mod_384_a_is_loaded::
add r8,QWORD PTR[rdx]
adc r9,QWORD PTR[8+rdx]
adc r10,QWORD PTR[16+rdx]
mov r14,r8
adc r11,QWORD PTR[24+rdx]
mov r15,r9
adc r12,QWORD PTR[32+rdx]
mov rax,r10
adc r13,QWORD PTR[40+rdx]
mov rbx,r11
sbb rdx,rdx
sub r8,QWORD PTR[rcx]
sbb r9,QWORD PTR[8+rcx]
mov rbp,r12
sbb r10,QWORD PTR[16+rcx]
sbb r11,QWORD PTR[24+rcx]
sbb r12,QWORD PTR[32+rcx]
mov rsi,r13
sbb r13,QWORD PTR[40+rcx]
sbb rdx,0
cmovc r8,r14
cmovc r9,r15
cmovc r10,rax
mov QWORD PTR[rdi],r8
cmovc r11,rbx
mov QWORD PTR[8+rdi],r9
cmovc r12,rbp
mov QWORD PTR[16+rdi],r10
cmovc r13,rsi
mov QWORD PTR[24+rdi],r11
mov QWORD PTR[32+rdi],r12
mov QWORD PTR[40+rdi],r13
DB 0F3h,0C3h ;repret
__add_mod_384 ENDP
PUBLIC add_mod_384x
ALIGN 32
add_mod_384x PROC PUBLIC
DB 243,15,30,250
mov QWORD PTR[8+rsp],rdi ;WIN64 prologue
mov QWORD PTR[16+rsp],rsi
mov r11,rsp
$L$SEH_begin_add_mod_384x::
mov rdi,rcx
mov rsi,rdx
mov rdx,r8
mov rcx,r9
push rbp
push rbx
push r12
push r13
push r14
push r15
sub rsp,24
$L$SEH_body_add_mod_384x::
mov QWORD PTR[rsp],rsi
mov QWORD PTR[8+rsp],rdx
lea rsi,QWORD PTR[48+rsi]
lea rdx,QWORD PTR[48+rdx]
lea rdi,QWORD PTR[48+rdi]
call __add_mod_384
mov rsi,QWORD PTR[rsp]
mov rdx,QWORD PTR[8+rsp]
lea rdi,QWORD PTR[((-48))+rdi]
call __add_mod_384
mov r15,QWORD PTR[((24+0))+rsp]
mov r14,QWORD PTR[((24+8))+rsp]
mov r13,QWORD PTR[((24+16))+rsp]
mov r12,QWORD PTR[((24+24))+rsp]
mov rbx,QWORD PTR[((24+32))+rsp]
mov rbp,QWORD PTR[((24+40))+rsp]
lea rsp,QWORD PTR[((24+48))+rsp]
$L$SEH_epilogue_add_mod_384x::
mov rdi,QWORD PTR[8+rsp] ;WIN64 epilogue
mov rsi,QWORD PTR[16+rsp]
DB 0F3h,0C3h ;repret
$L$SEH_end_add_mod_384x::
add_mod_384x ENDP
PUBLIC lshift_mod_384
ALIGN 32
lshift_mod_384 PROC PUBLIC
DB 243,15,30,250
mov QWORD PTR[8+rsp],rdi ;WIN64 prologue
mov QWORD PTR[16+rsp],rsi
mov r11,rsp
$L$SEH_begin_lshift_mod_384::
mov rdi,rcx
mov rsi,rdx
mov rdx,r8
mov rcx,r9
push rbp
push rbx
push r12
push r13
push r14
push r15
push rdi
$L$SEH_body_lshift_mod_384::
mov r8,QWORD PTR[rsi]
mov r9,QWORD PTR[8+rsi]
mov r10,QWORD PTR[16+rsi]
mov r11,QWORD PTR[24+rsi]
mov r12,QWORD PTR[32+rsi]
mov r13,QWORD PTR[40+rsi]
$L$oop_lshift_mod_384::
add r8,r8
adc r9,r9
adc r10,r10
mov r14,r8
adc r11,r11
mov r15,r9
adc r12,r12
mov rax,r10
adc r13,r13
mov rbx,r11
sbb rdi,rdi
sub r8,QWORD PTR[rcx]
sbb r9,QWORD PTR[8+rcx]
mov rbp,r12
sbb r10,QWORD PTR[16+rcx]
sbb r11,QWORD PTR[24+rcx]
sbb r12,QWORD PTR[32+rcx]
mov rsi,r13
sbb r13,QWORD PTR[40+rcx]
sbb rdi,0
mov rdi,QWORD PTR[rsp]
cmovc r8,r14
cmovc r9,r15
cmovc r10,rax
cmovc r11,rbx
cmovc r12,rbp
cmovc r13,rsi
dec edx
jnz $L$oop_lshift_mod_384
mov QWORD PTR[rdi],r8
mov QWORD PTR[8+rdi],r9
mov QWORD PTR[16+rdi],r10
mov QWORD PTR[24+rdi],r11
mov QWORD PTR[32+rdi],r12
mov QWORD PTR[40+rdi],r13
mov r15,QWORD PTR[8+rsp]
mov r14,QWORD PTR[16+rsp]
mov r13,QWORD PTR[24+rsp]
mov r12,QWORD PTR[32+rsp]
mov rbx,QWORD PTR[40+rsp]
mov rbp,QWORD PTR[48+rsp]
lea rsp,QWORD PTR[56+rsp]
$L$SEH_epilogue_lshift_mod_384::
mov rdi,QWORD PTR[8+rsp] ;WIN64 epilogue
mov rsi,QWORD PTR[16+rsp]
DB 0F3h,0C3h ;repret
$L$SEH_end_lshift_mod_384::
lshift_mod_384 ENDP
ALIGN 32
__lshift_mod_384 PROC PRIVATE
DB 243,15,30,250
add r8,r8
adc r9,r9
adc r10,r10
mov r14,r8
adc r11,r11
mov r15,r9
adc r12,r12
mov rax,r10
adc r13,r13
mov rbx,r11
sbb rdx,rdx
sub r8,QWORD PTR[rcx]
sbb r9,QWORD PTR[8+rcx]
mov rbp,r12
sbb r10,QWORD PTR[16+rcx]
sbb r11,QWORD PTR[24+rcx]
sbb r12,QWORD PTR[32+rcx]
mov rsi,r13
sbb r13,QWORD PTR[40+rcx]
sbb rdx,0
cmovc r8,r14
cmovc r9,r15
cmovc r10,rax
cmovc r11,rbx
cmovc r12,rbp
cmovc r13,rsi
DB 0F3h,0C3h ;repret
__lshift_mod_384 ENDP
PUBLIC mul_by_3_mod_384
ALIGN 32
mul_by_3_mod_384 PROC PUBLIC
DB 243,15,30,250
mov QWORD PTR[8+rsp],rdi ;WIN64 prologue
mov QWORD PTR[16+rsp],rsi
mov r11,rsp
$L$SEH_begin_mul_by_3_mod_384::
mov rdi,rcx
mov rsi,rdx
mov rdx,r8
push rbp
push rbx
push r12
push r13
push r14
push r15
push rsi
$L$SEH_body_mul_by_3_mod_384::
mov r8,QWORD PTR[rsi]
mov r9,QWORD PTR[8+rsi]
mov r10,QWORD PTR[16+rsi]
mov r11,QWORD PTR[24+rsi]
mov r12,QWORD PTR[32+rsi]
mov r13,QWORD PTR[40+rsi]
mov rcx,rdx
call __lshift_mod_384
mov rdx,QWORD PTR[rsp]
call __add_mod_384_a_is_loaded
mov r15,QWORD PTR[8+rsp]
mov r14,QWORD PTR[16+rsp]
mov r13,QWORD PTR[24+rsp]
mov r12,QWORD PTR[32+rsp]
mov rbx,QWORD PTR[40+rsp]
mov rbp,QWORD PTR[48+rsp]
lea rsp,QWORD PTR[56+rsp]
$L$SEH_epilogue_mul_by_3_mod_384::
mov rdi,QWORD PTR[8+rsp] ;WIN64 epilogue
mov rsi,QWORD PTR[16+rsp]
DB 0F3h,0C3h ;repret
$L$SEH_end_mul_by_3_mod_384::
mul_by_3_mod_384 ENDP
PUBLIC mul_by_8_mod_384
ALIGN 32
mul_by_8_mod_384 PROC PUBLIC
DB 243,15,30,250
mov QWORD PTR[8+rsp],rdi ;WIN64 prologue
mov QWORD PTR[16+rsp],rsi
mov r11,rsp
$L$SEH_begin_mul_by_8_mod_384::
mov rdi,rcx
mov rsi,rdx
mov rdx,r8
push rbp
push rbx
push r12
push r13
push r14
push r15
sub rsp,8
$L$SEH_body_mul_by_8_mod_384::
mov r8,QWORD PTR[rsi]
mov r9,QWORD PTR[8+rsi]
mov r10,QWORD PTR[16+rsi]
mov r11,QWORD PTR[24+rsi]
mov r12,QWORD PTR[32+rsi]
mov r13,QWORD PTR[40+rsi]
mov rcx,rdx
call __lshift_mod_384
call __lshift_mod_384
call __lshift_mod_384
mov QWORD PTR[rdi],r8
mov QWORD PTR[8+rdi],r9
mov QWORD PTR[16+rdi],r10
mov QWORD PTR[24+rdi],r11
mov QWORD PTR[32+rdi],r12
mov QWORD PTR[40+rdi],r13
mov r15,QWORD PTR[8+rsp]
mov r14,QWORD PTR[16+rsp]
mov r13,QWORD PTR[24+rsp]
mov r12,QWORD PTR[32+rsp]
mov rbx,QWORD PTR[40+rsp]
mov rbp,QWORD PTR[48+rsp]
lea rsp,QWORD PTR[56+rsp]
$L$SEH_epilogue_mul_by_8_mod_384::
mov rdi,QWORD PTR[8+rsp] ;WIN64 epilogue
mov rsi,QWORD PTR[16+rsp]
DB 0F3h,0C3h ;repret
$L$SEH_end_mul_by_8_mod_384::
mul_by_8_mod_384 ENDP
PUBLIC mul_by_b_onE1
ALIGN 32
mul_by_b_onE1 PROC PUBLIC
DB 243,15,30,250
mov QWORD PTR[8+rsp],rdi ;WIN64 prologue
mov QWORD PTR[16+rsp],rsi
mov r11,rsp
$L$SEH_begin_mul_by_b_onE1::
mov rdi,rcx
mov rsi,rdx
push rbp
push rbx
push r12
push r13
push r14
push r15
sub rsp,8
$L$SEH_body_mul_by_b_onE1::
mov r8,QWORD PTR[rsi]
mov r9,QWORD PTR[8+rsi]
mov r10,QWORD PTR[16+rsi]
mov r11,QWORD PTR[24+rsi]
mov r12,QWORD PTR[32+rsi]
mov r13,QWORD PTR[40+rsi]
lea rcx,QWORD PTR[BLS12_381_P]
call __lshift_mod_384
call __lshift_mod_384
mov QWORD PTR[rdi],r8
mov QWORD PTR[8+rdi],r9
mov QWORD PTR[16+rdi],r10
mov QWORD PTR[24+rdi],r11
mov QWORD PTR[32+rdi],r12
mov QWORD PTR[40+rdi],r13
mov r15,QWORD PTR[8+rsp]
mov r14,QWORD PTR[16+rsp]
mov r13,QWORD PTR[24+rsp]
mov r12,QWORD PTR[32+rsp]
mov rbx,QWORD PTR[40+rsp]
mov rbp,QWORD PTR[48+rsp]
lea rsp,QWORD PTR[56+rsp]
$L$SEH_epilogue_mul_by_b_onE1::
mov rdi,QWORD PTR[8+rsp] ;WIN64 epilogue
mov rsi,QWORD PTR[16+rsp]
DB 0F3h,0C3h ;repret
$L$SEH_end_mul_by_b_onE1::
mul_by_b_onE1 ENDP
PUBLIC mul_by_4b_onE1
ALIGN 32
mul_by_4b_onE1 PROC PUBLIC
DB 243,15,30,250
mov QWORD PTR[8+rsp],rdi ;WIN64 prologue
mov QWORD PTR[16+rsp],rsi
mov r11,rsp
$L$SEH_begin_mul_by_4b_onE1::
mov rdi,rcx
mov rsi,rdx
push rbp
push rbx
push r12
push r13
push r14
push r15
sub rsp,8
$L$SEH_body_mul_by_4b_onE1::
mov r8,QWORD PTR[rsi]
mov r9,QWORD PTR[8+rsi]
mov r10,QWORD PTR[16+rsi]
mov r11,QWORD PTR[24+rsi]
mov r12,QWORD PTR[32+rsi]
mov r13,QWORD PTR[40+rsi]
lea rcx,QWORD PTR[BLS12_381_P]
call __lshift_mod_384
call __lshift_mod_384
call __lshift_mod_384
call __lshift_mod_384
mov QWORD PTR[rdi],r8
mov QWORD PTR[8+rdi],r9
mov QWORD PTR[16+rdi],r10
mov QWORD PTR[24+rdi],r11
mov QWORD PTR[32+rdi],r12
mov QWORD PTR[40+rdi],r13
mov r15,QWORD PTR[8+rsp]
mov r14,QWORD PTR[16+rsp]
mov r13,QWORD PTR[24+rsp]
mov r12,QWORD PTR[32+rsp]
mov rbx,QWORD PTR[40+rsp]
mov rbp,QWORD PTR[48+rsp]
lea rsp,QWORD PTR[56+rsp]
$L$SEH_epilogue_mul_by_4b_onE1::
mov rdi,QWORD PTR[8+rsp] ;WIN64 epilogue
mov rsi,QWORD PTR[16+rsp]
DB 0F3h,0C3h ;repret
$L$SEH_end_mul_by_4b_onE1::
mul_by_4b_onE1 ENDP
PUBLIC mul_by_3_mod_384x
ALIGN 32
mul_by_3_mod_384x PROC PUBLIC
DB 243,15,30,250
mov QWORD PTR[8+rsp],rdi ;WIN64 prologue
mov QWORD PTR[16+rsp],rsi
mov r11,rsp
$L$SEH_begin_mul_by_3_mod_384x::
mov rdi,rcx
mov rsi,rdx
mov rdx,r8
push rbp
push rbx
push r12
push r13
push r14
push r15
push rsi
$L$SEH_body_mul_by_3_mod_384x::
mov r8,QWORD PTR[rsi]
mov r9,QWORD PTR[8+rsi]
mov r10,QWORD PTR[16+rsi]
mov r11,QWORD PTR[24+rsi]
mov r12,QWORD PTR[32+rsi]
mov r13,QWORD PTR[40+rsi]
mov rcx,rdx
call __lshift_mod_384
mov rdx,QWORD PTR[rsp]
call __add_mod_384_a_is_loaded
mov rsi,QWORD PTR[rsp]
lea rdi,QWORD PTR[48+rdi]
mov r8,QWORD PTR[48+rsi]
mov r9,QWORD PTR[56+rsi]
mov r10,QWORD PTR[64+rsi]
mov r11,QWORD PTR[72+rsi]
mov r12,QWORD PTR[80+rsi]
mov r13,QWORD PTR[88+rsi]
call __lshift_mod_384
mov rdx,8*6
add rdx,QWORD PTR[rsp]
call __add_mod_384_a_is_loaded
mov r15,QWORD PTR[8+rsp]
mov r14,QWORD PTR[16+rsp]
mov r13,QWORD PTR[24+rsp]
mov r12,QWORD PTR[32+rsp]
mov rbx,QWORD PTR[40+rsp]
mov rbp,QWORD PTR[48+rsp]
lea rsp,QWORD PTR[56+rsp]
$L$SEH_epilogue_mul_by_3_mod_384x::
mov rdi,QWORD PTR[8+rsp] ;WIN64 epilogue
mov rsi,QWORD PTR[16+rsp]
DB 0F3h,0C3h ;repret
$L$SEH_end_mul_by_3_mod_384x::
mul_by_3_mod_384x ENDP
PUBLIC mul_by_8_mod_384x
ALIGN 32
mul_by_8_mod_384x PROC PUBLIC
DB 243,15,30,250
mov QWORD PTR[8+rsp],rdi ;WIN64 prologue
mov QWORD PTR[16+rsp],rsi
mov r11,rsp
$L$SEH_begin_mul_by_8_mod_384x::
mov rdi,rcx
mov rsi,rdx
mov rdx,r8
push rbp
push rbx
push r12
push r13
push r14
push r15
push rsi
$L$SEH_body_mul_by_8_mod_384x::
mov r8,QWORD PTR[rsi]
mov r9,QWORD PTR[8+rsi]
mov r10,QWORD PTR[16+rsi]
mov r11,QWORD PTR[24+rsi]
mov r12,QWORD PTR[32+rsi]
mov r13,QWORD PTR[40+rsi]
mov rcx,rdx
call __lshift_mod_384
call __lshift_mod_384
call __lshift_mod_384
mov rsi,QWORD PTR[rsp]
mov QWORD PTR[rdi],r8
mov QWORD PTR[8+rdi],r9
mov QWORD PTR[16+rdi],r10
mov QWORD PTR[24+rdi],r11
mov QWORD PTR[32+rdi],r12
mov QWORD PTR[40+rdi],r13
mov r8,QWORD PTR[((48+0))+rsi]
mov r9,QWORD PTR[((48+8))+rsi]
mov r10,QWORD PTR[((48+16))+rsi]
mov r11,QWORD PTR[((48+24))+rsi]
mov r12,QWORD PTR[((48+32))+rsi]
mov r13,QWORD PTR[((48+40))+rsi]
call __lshift_mod_384
call __lshift_mod_384
call __lshift_mod_384
mov QWORD PTR[((48+0))+rdi],r8
mov QWORD PTR[((48+8))+rdi],r9
mov QWORD PTR[((48+16))+rdi],r10
mov QWORD PTR[((48+24))+rdi],r11
mov QWORD PTR[((48+32))+rdi],r12
mov QWORD PTR[((48+40))+rdi],r13
mov r15,QWORD PTR[8+rsp]
mov r14,QWORD PTR[16+rsp]
mov r13,QWORD PTR[24+rsp]
mov r12,QWORD PTR[32+rsp]
mov rbx,QWORD PTR[40+rsp]
mov rbp,QWORD PTR[48+rsp]
lea rsp,QWORD PTR[56+rsp]
$L$SEH_epilogue_mul_by_8_mod_384x::
mov rdi,QWORD PTR[8+rsp] ;WIN64 epilogue
mov rsi,QWORD PTR[16+rsp]
DB 0F3h,0C3h ;repret
$L$SEH_end_mul_by_8_mod_384x::
mul_by_8_mod_384x ENDP
PUBLIC mul_by_b_onE2
ALIGN 32
mul_by_b_onE2 PROC PUBLIC
DB 243,15,30,250
mov QWORD PTR[8+rsp],rdi ;WIN64 prologue
mov QWORD PTR[16+rsp],rsi
mov r11,rsp
$L$SEH_begin_mul_by_b_onE2::
mov rdi,rcx
mov rsi,rdx
push rbp
push rbx
push r12
push r13
push r14
push r15
push rsi
$L$SEH_body_mul_by_b_onE2::
lea rcx,QWORD PTR[BLS12_381_P]
lea rdx,QWORD PTR[48+rsi]
call __sub_mod_384
call __lshift_mod_384
call __lshift_mod_384
mov rsi,QWORD PTR[rsp]
mov QWORD PTR[rdi],r8
mov QWORD PTR[8+rdi],r9
mov QWORD PTR[16+rdi],r10
mov QWORD PTR[24+rdi],r11
mov QWORD PTR[32+rdi],r12
mov QWORD PTR[40+rdi],r13
lea rdx,QWORD PTR[48+rsi]
lea rdi,QWORD PTR[48+rdi]
call __add_mod_384
call __lshift_mod_384
call __lshift_mod_384
mov QWORD PTR[rdi],r8
mov QWORD PTR[8+rdi],r9
mov QWORD PTR[16+rdi],r10
mov QWORD PTR[24+rdi],r11
mov QWORD PTR[32+rdi],r12
mov QWORD PTR[40+rdi],r13
mov r15,QWORD PTR[8+rsp]
mov r14,QWORD PTR[16+rsp]
mov r13,QWORD PTR[24+rsp]
mov r12,QWORD PTR[32+rsp]
mov rbx,QWORD PTR[40+rsp]
mov rbp,QWORD PTR[48+rsp]
lea rsp,QWORD PTR[56+rsp]
$L$SEH_epilogue_mul_by_b_onE2::
mov rdi,QWORD PTR[8+rsp] ;WIN64 epilogue
mov rsi,QWORD PTR[16+rsp]
DB 0F3h,0C3h ;repret
$L$SEH_end_mul_by_b_onE2::
mul_by_b_onE2 ENDP
PUBLIC mul_by_4b_onE2
ALIGN 32
mul_by_4b_onE2 PROC PUBLIC
DB 243,15,30,250
mov QWORD PTR[8+rsp],rdi ;WIN64 prologue
mov QWORD PTR[16+rsp],rsi
mov r11,rsp
$L$SEH_begin_mul_by_4b_onE2::
mov rdi,rcx
mov rsi,rdx
push rbp
push rbx
push r12
push r13
push r14
push r15
push rsi
$L$SEH_body_mul_by_4b_onE2::
lea rcx,QWORD PTR[BLS12_381_P]
lea rdx,QWORD PTR[48+rsi]
call __sub_mod_384
call __lshift_mod_384
call __lshift_mod_384
call __lshift_mod_384
call __lshift_mod_384
mov rsi,QWORD PTR[rsp]
mov QWORD PTR[rdi],r8
mov QWORD PTR[8+rdi],r9
mov QWORD PTR[16+rdi],r10
mov QWORD PTR[24+rdi],r11
mov QWORD PTR[32+rdi],r12
mov QWORD PTR[40+rdi],r13
lea rdx,QWORD PTR[48+rsi]
lea rdi,QWORD PTR[48+rdi]
call __add_mod_384
call __lshift_mod_384
call __lshift_mod_384
call __lshift_mod_384
call __lshift_mod_384
mov QWORD PTR[rdi],r8
mov QWORD PTR[8+rdi],r9
mov QWORD PTR[16+rdi],r10
mov QWORD PTR[24+rdi],r11
mov QWORD PTR[32+rdi],r12
mov QWORD PTR[40+rdi],r13
mov r15,QWORD PTR[8+rsp]
mov r14,QWORD PTR[16+rsp]
mov r13,QWORD PTR[24+rsp]
mov r12,QWORD PTR[32+rsp]
mov rbx,QWORD PTR[40+rsp]
mov rbp,QWORD PTR[48+rsp]
lea rsp,QWORD PTR[56+rsp]
$L$SEH_epilogue_mul_by_4b_onE2::
mov rdi,QWORD PTR[8+rsp] ;WIN64 epilogue
mov rsi,QWORD PTR[16+rsp]
DB 0F3h,0C3h ;repret
$L$SEH_end_mul_by_4b_onE2::
mul_by_4b_onE2 ENDP
PUBLIC cneg_mod_384
ALIGN 32
cneg_mod_384 PROC PUBLIC
DB 243,15,30,250
mov QWORD PTR[8+rsp],rdi ;WIN64 prologue
mov QWORD PTR[16+rsp],rsi
mov r11,rsp
$L$SEH_begin_cneg_mod_384::
mov rdi,rcx
mov rsi,rdx
mov rdx,r8
mov rcx,r9
push rbp
push rbx
push r12
push r13
push r14
push r15
push rdx
$L$SEH_body_cneg_mod_384::
mov rdx,QWORD PTR[rsi]
mov r9,QWORD PTR[8+rsi]
mov r10,QWORD PTR[16+rsi]
mov r8,rdx
mov r11,QWORD PTR[24+rsi]
or rdx,r9
mov r12,QWORD PTR[32+rsi]
or rdx,r10
mov r13,QWORD PTR[40+rsi]
or rdx,r11
mov rsi,-1
or rdx,r12
or rdx,r13
mov r14,QWORD PTR[rcx]
cmovnz rdx,rsi
mov r15,QWORD PTR[8+rcx]
mov rax,QWORD PTR[16+rcx]
and r14,rdx
mov rbx,QWORD PTR[24+rcx]
and r15,rdx
mov rbp,QWORD PTR[32+rcx]
and rax,rdx
mov rsi,QWORD PTR[40+rcx]
and rbx,rdx
mov rcx,QWORD PTR[rsp]
and rbp,rdx
and rsi,rdx
sub r14,r8
sbb r15,r9
sbb rax,r10
sbb rbx,r11
sbb rbp,r12
sbb rsi,r13
or rcx,rcx
cmovz r14,r8
cmovz r15,r9
cmovz rax,r10
mov QWORD PTR[rdi],r14
cmovz rbx,r11
mov QWORD PTR[8+rdi],r15
cmovz rbp,r12
mov QWORD PTR[16+rdi],rax
cmovz rsi,r13
mov QWORD PTR[24+rdi],rbx
mov QWORD PTR[32+rdi],rbp
mov QWORD PTR[40+rdi],rsi
mov r15,QWORD PTR[8+rsp]
mov r14,QWORD PTR[16+rsp]
mov r13,QWORD PTR[24+rsp]
mov r12,QWORD PTR[32+rsp]
mov rbx,QWORD PTR[40+rsp]
mov rbp,QWORD PTR[48+rsp]
lea rsp,QWORD PTR[56+rsp]
$L$SEH_epilogue_cneg_mod_384::
mov rdi,QWORD PTR[8+rsp] ;WIN64 epilogue
mov rsi,QWORD PTR[16+rsp]
DB 0F3h,0C3h ;repret
$L$SEH_end_cneg_mod_384::
cneg_mod_384 ENDP
PUBLIC sub_mod_384
ALIGN 32
sub_mod_384 PROC PUBLIC
DB 243,15,30,250
mov QWORD PTR[8+rsp],rdi ;WIN64 prologue
mov QWORD PTR[16+rsp],rsi
mov r11,rsp
$L$SEH_begin_sub_mod_384::
mov rdi,rcx
mov rsi,rdx
mov rdx,r8
mov rcx,r9
push rbp
push rbx
push r12
push r13
push r14
push r15
sub rsp,8
$L$SEH_body_sub_mod_384::
call __sub_mod_384
mov r15,QWORD PTR[8+rsp]
mov r14,QWORD PTR[16+rsp]
mov r13,QWORD PTR[24+rsp]
mov r12,QWORD PTR[32+rsp]
mov rbx,QWORD PTR[40+rsp]
mov rbp,QWORD PTR[48+rsp]
lea rsp,QWORD PTR[56+rsp]
$L$SEH_epilogue_sub_mod_384::
mov rdi,QWORD PTR[8+rsp] ;WIN64 epilogue
mov rsi,QWORD PTR[16+rsp]
DB 0F3h,0C3h ;repret
$L$SEH_end_sub_mod_384::
sub_mod_384 ENDP
ALIGN 32
__sub_mod_384 PROC PRIVATE
DB 243,15,30,250
mov r8,QWORD PTR[rsi]
mov r9,QWORD PTR[8+rsi]
mov r10,QWORD PTR[16+rsi]
mov r11,QWORD PTR[24+rsi]
mov r12,QWORD PTR[32+rsi]
mov r13,QWORD PTR[40+rsi]
sub r8,QWORD PTR[rdx]
mov r14,QWORD PTR[rcx]
sbb r9,QWORD PTR[8+rdx]
mov r15,QWORD PTR[8+rcx]
sbb r10,QWORD PTR[16+rdx]
mov rax,QWORD PTR[16+rcx]
sbb r11,QWORD PTR[24+rdx]
mov rbx,QWORD PTR[24+rcx]
sbb r12,QWORD PTR[32+rdx]
mov rbp,QWORD PTR[32+rcx]
sbb r13,QWORD PTR[40+rdx]
mov rsi,QWORD PTR[40+rcx]
sbb rdx,rdx
and r14,rdx
and r15,rdx
and rax,rdx
and rbx,rdx
and rbp,rdx
and rsi,rdx
add r8,r14
adc r9,r15
mov QWORD PTR[rdi],r8
adc r10,rax
mov QWORD PTR[8+rdi],r9
adc r11,rbx
mov QWORD PTR[16+rdi],r10
adc r12,rbp
mov QWORD PTR[24+rdi],r11
adc r13,rsi
mov QWORD PTR[32+rdi],r12
mov QWORD PTR[40+rdi],r13
DB 0F3h,0C3h ;repret
__sub_mod_384 ENDP
PUBLIC sub_mod_384x
ALIGN 32
sub_mod_384x PROC PUBLIC
DB 243,15,30,250
mov QWORD PTR[8+rsp],rdi ;WIN64 prologue
mov QWORD PTR[16+rsp],rsi
mov r11,rsp
$L$SEH_begin_sub_mod_384x::
mov rdi,rcx
mov rsi,rdx
mov rdx,r8
mov rcx,r9
push rbp
push rbx
push r12
push r13
push r14
push r15
sub rsp,24
$L$SEH_body_sub_mod_384x::
mov QWORD PTR[rsp],rsi
mov QWORD PTR[8+rsp],rdx
lea rsi,QWORD PTR[48+rsi]
lea rdx,QWORD PTR[48+rdx]
lea rdi,QWORD PTR[48+rdi]
call __sub_mod_384
mov rsi,QWORD PTR[rsp]
mov rdx,QWORD PTR[8+rsp]
lea rdi,QWORD PTR[((-48))+rdi]
call __sub_mod_384
mov r15,QWORD PTR[((24+0))+rsp]
mov r14,QWORD PTR[((24+8))+rsp]
mov r13,QWORD PTR[((24+16))+rsp]
mov r12,QWORD PTR[((24+24))+rsp]
mov rbx,QWORD PTR[((24+32))+rsp]
mov rbp,QWORD PTR[((24+40))+rsp]
lea rsp,QWORD PTR[((24+48))+rsp]
$L$SEH_epilogue_sub_mod_384x::
mov rdi,QWORD PTR[8+rsp] ;WIN64 epilogue
mov rsi,QWORD PTR[16+rsp]
DB 0F3h,0C3h ;repret
$L$SEH_end_sub_mod_384x::
sub_mod_384x ENDP
PUBLIC mul_by_1_plus_i_mod_384x
ALIGN 32
mul_by_1_plus_i_mod_384x PROC PUBLIC
DB 243,15,30,250
mov QWORD PTR[8+rsp],rdi ;WIN64 prologue
mov QWORD PTR[16+rsp],rsi
mov r11,rsp
$L$SEH_begin_mul_by_1_plus_i_mod_384x::
mov rdi,rcx
mov rsi,rdx
mov rdx,r8
push rbp
push rbx
push r12
push r13
push r14
push r15
sub rsp,56
$L$SEH_body_mul_by_1_plus_i_mod_384x::
mov r8,QWORD PTR[rsi]
mov r9,QWORD PTR[8+rsi]
mov r10,QWORD PTR[16+rsi]
mov r11,QWORD PTR[24+rsi]
mov r12,QWORD PTR[32+rsi]
mov r13,QWORD PTR[40+rsi]
mov r14,r8
add r8,QWORD PTR[48+rsi]
mov r15,r9
adc r9,QWORD PTR[56+rsi]
mov rax,r10
adc r10,QWORD PTR[64+rsi]
mov rbx,r11
adc r11,QWORD PTR[72+rsi]
mov rcx,r12
adc r12,QWORD PTR[80+rsi]
mov rbp,r13
adc r13,QWORD PTR[88+rsi]
mov QWORD PTR[48+rsp],rdi
sbb rdi,rdi
sub r14,QWORD PTR[48+rsi]
sbb r15,QWORD PTR[56+rsi]
sbb rax,QWORD PTR[64+rsi]
sbb rbx,QWORD PTR[72+rsi]
sbb rcx,QWORD PTR[80+rsi]
sbb rbp,QWORD PTR[88+rsi]
sbb rsi,rsi
mov QWORD PTR[rsp],r8
mov r8,QWORD PTR[rdx]
mov QWORD PTR[8+rsp],r9
mov r9,QWORD PTR[8+rdx]
mov QWORD PTR[16+rsp],r10
mov r10,QWORD PTR[16+rdx]
mov QWORD PTR[24+rsp],r11
mov r11,QWORD PTR[24+rdx]
mov QWORD PTR[32+rsp],r12
and r8,rsi
mov r12,QWORD PTR[32+rdx]
mov QWORD PTR[40+rsp],r13
and r9,rsi
mov r13,QWORD PTR[40+rdx]
and r10,rsi
and r11,rsi
and r12,rsi
and r13,rsi
mov rsi,QWORD PTR[48+rsp]
add r14,r8
mov r8,QWORD PTR[rsp]
adc r15,r9
mov r9,QWORD PTR[8+rsp]
adc rax,r10
mov r10,QWORD PTR[16+rsp]
adc rbx,r11
mov r11,QWORD PTR[24+rsp]
adc rcx,r12
mov r12,QWORD PTR[32+rsp]
adc rbp,r13
mov r13,QWORD PTR[40+rsp]
mov QWORD PTR[rsi],r14
mov r14,r8
mov QWORD PTR[8+rsi],r15
mov QWORD PTR[16+rsi],rax
mov r15,r9
mov QWORD PTR[24+rsi],rbx
mov QWORD PTR[32+rsi],rcx
mov rax,r10
mov QWORD PTR[40+rsi],rbp
sub r8,QWORD PTR[rdx]
mov rbx,r11
sbb r9,QWORD PTR[8+rdx]
sbb r10,QWORD PTR[16+rdx]
mov rcx,r12
sbb r11,QWORD PTR[24+rdx]
sbb r12,QWORD PTR[32+rdx]
mov rbp,r13
sbb r13,QWORD PTR[40+rdx]
sbb rdi,0
cmovc r8,r14
cmovc r9,r15
cmovc r10,rax
mov QWORD PTR[48+rsi],r8
cmovc r11,rbx
mov QWORD PTR[56+rsi],r9
cmovc r12,rcx
mov QWORD PTR[64+rsi],r10
cmovc r13,rbp
mov QWORD PTR[72+rsi],r11
mov QWORD PTR[80+rsi],r12
mov QWORD PTR[88+rsi],r13
mov r15,QWORD PTR[((56+0))+rsp]
mov r14,QWORD PTR[((56+8))+rsp]
mov r13,QWORD PTR[((56+16))+rsp]
mov r12,QWORD PTR[((56+24))+rsp]
mov rbx,QWORD PTR[((56+32))+rsp]
mov rbp,QWORD PTR[((56+40))+rsp]
lea rsp,QWORD PTR[((56+48))+rsp]
$L$SEH_epilogue_mul_by_1_plus_i_mod_384x::
mov rdi,QWORD PTR[8+rsp] ;WIN64 epilogue
mov rsi,QWORD PTR[16+rsp]
DB 0F3h,0C3h ;repret
$L$SEH_end_mul_by_1_plus_i_mod_384x::
mul_by_1_plus_i_mod_384x ENDP
PUBLIC sgn0_pty_mod_384
ALIGN 32
sgn0_pty_mod_384 PROC PUBLIC
DB 243,15,30,250
mov QWORD PTR[8+rsp],rdi ;WIN64 prologue
mov QWORD PTR[16+rsp],rsi
mov r11,rsp
$L$SEH_begin_sgn0_pty_mod_384::
mov rdi,rcx
mov rsi,rdx
$L$SEH_body_sgn0_pty_mod_384::
mov r8,QWORD PTR[rdi]
mov r9,QWORD PTR[8+rdi]
mov r10,QWORD PTR[16+rdi]
mov r11,QWORD PTR[24+rdi]
mov rcx,QWORD PTR[32+rdi]
mov rdx,QWORD PTR[40+rdi]
xor rax,rax
mov rdi,r8
add r8,r8
adc r9,r9
adc r10,r10
adc r11,r11
adc rcx,rcx
adc rdx,rdx
adc rax,0
sub r8,QWORD PTR[rsi]
sbb r9,QWORD PTR[8+rsi]
sbb r10,QWORD PTR[16+rsi]
sbb r11,QWORD PTR[24+rsi]
sbb rcx,QWORD PTR[32+rsi]
sbb rdx,QWORD PTR[40+rsi]
sbb rax,0
not rax
and rdi,1
and rax,2
or rax,rdi
$L$SEH_epilogue_sgn0_pty_mod_384::
mov rdi,QWORD PTR[8+rsp] ;WIN64 epilogue
mov rsi,QWORD PTR[16+rsp]
DB 0F3h,0C3h ;repret
$L$SEH_end_sgn0_pty_mod_384::
sgn0_pty_mod_384 ENDP
PUBLIC sgn0_pty_mod_384x
ALIGN 32
sgn0_pty_mod_384x PROC PUBLIC
DB 243,15,30,250
mov QWORD PTR[8+rsp],rdi ;WIN64 prologue
mov QWORD PTR[16+rsp],rsi
mov r11,rsp
$L$SEH_begin_sgn0_pty_mod_384x::
mov rdi,rcx
mov rsi,rdx
push rbp
push rbx
sub rsp,8
$L$SEH_body_sgn0_pty_mod_384x::
mov r8,QWORD PTR[rdi]
mov r9,QWORD PTR[8+rdi]
mov r10,QWORD PTR[16+rdi]
mov r11,QWORD PTR[24+rdi]
mov rcx,QWORD PTR[32+rdi]
mov rdx,QWORD PTR[40+rdi]
mov rbx,r8
or r8,r9
or r8,r10
or r8,r11
or r8,rcx
or r8,rdx
xor rax,rax
mov rbp,rbx
add rbx,rbx
adc r9,r9
adc r10,r10
adc r11,r11
adc rcx,rcx
adc rdx,rdx
adc rax,0
sub rbx,QWORD PTR[rsi]
sbb r9,QWORD PTR[8+rsi]
sbb r10,QWORD PTR[16+rsi]
sbb r11,QWORD PTR[24+rsi]
sbb rcx,QWORD PTR[32+rsi]
sbb rdx,QWORD PTR[40+rsi]
sbb rax,0
mov QWORD PTR[rsp],r8
not rax
and rbp,1
and rax,2
or rax,rbp
mov r8,QWORD PTR[48+rdi]
mov r9,QWORD PTR[56+rdi]
mov r10,QWORD PTR[64+rdi]
mov r11,QWORD PTR[72+rdi]
mov rcx,QWORD PTR[80+rdi]
mov rdx,QWORD PTR[88+rdi]
mov rbx,r8
or r8,r9
or r8,r10
or r8,r11
or r8,rcx
or r8,rdx
xor rdi,rdi
mov rbp,rbx
add rbx,rbx
adc r9,r9
adc r10,r10
adc r11,r11
adc rcx,rcx
adc rdx,rdx
adc rdi,0
sub rbx,QWORD PTR[rsi]
sbb r9,QWORD PTR[8+rsi]
sbb r10,QWORD PTR[16+rsi]
sbb r11,QWORD PTR[24+rsi]
sbb rcx,QWORD PTR[32+rsi]
sbb rdx,QWORD PTR[40+rsi]
sbb rdi,0
mov rbx,QWORD PTR[rsp]
not rdi
test r8,r8
cmovnz rax,rdi
test rbx,rbx
cmovz rbp,rdi
and rbp,1
and rax,2
or rax,rbp
mov rbx,QWORD PTR[8+rsp]
mov rbp,QWORD PTR[16+rsp]
lea rsp,QWORD PTR[24+rsp]
$L$SEH_epilogue_sgn0_pty_mod_384x::
mov rdi,QWORD PTR[8+rsp] ;WIN64 epilogue
mov rsi,QWORD PTR[16+rsp]
DB 0F3h,0C3h ;repret
$L$SEH_end_sgn0_pty_mod_384x::
sgn0_pty_mod_384x ENDP
.text$ ENDS
.pdata SEGMENT READONLY ALIGN(4)
ALIGN 4
DD imagerel $L$SEH_begin_add_mod_384
DD imagerel $L$SEH_body_add_mod_384
DD imagerel $L$SEH_info_add_mod_384_prologue
DD imagerel $L$SEH_body_add_mod_384
DD imagerel $L$SEH_epilogue_add_mod_384
DD imagerel $L$SEH_info_add_mod_384_body
DD imagerel $L$SEH_epilogue_add_mod_384
DD imagerel $L$SEH_end_add_mod_384
DD imagerel $L$SEH_info_add_mod_384_epilogue
DD imagerel $L$SEH_begin_add_mod_384x
DD imagerel $L$SEH_body_add_mod_384x
DD imagerel $L$SEH_info_add_mod_384x_prologue
DD imagerel $L$SEH_body_add_mod_384x
DD imagerel $L$SEH_epilogue_add_mod_384x
DD imagerel $L$SEH_info_add_mod_384x_body
DD imagerel $L$SEH_epilogue_add_mod_384x
DD imagerel $L$SEH_end_add_mod_384x
DD imagerel $L$SEH_info_add_mod_384x_epilogue
DD imagerel $L$SEH_begin_lshift_mod_384
DD imagerel $L$SEH_body_lshift_mod_384
DD imagerel $L$SEH_info_lshift_mod_384_prologue
DD imagerel $L$SEH_body_lshift_mod_384
DD imagerel $L$SEH_epilogue_lshift_mod_384
DD imagerel $L$SEH_info_lshift_mod_384_body
DD imagerel $L$SEH_epilogue_lshift_mod_384
DD imagerel $L$SEH_end_lshift_mod_384
DD imagerel $L$SEH_info_lshift_mod_384_epilogue
DD imagerel $L$SEH_begin_mul_by_3_mod_384
DD imagerel $L$SEH_body_mul_by_3_mod_384
DD imagerel $L$SEH_info_mul_by_3_mod_384_prologue
DD imagerel $L$SEH_body_mul_by_3_mod_384
DD imagerel $L$SEH_epilogue_mul_by_3_mod_384
DD imagerel $L$SEH_info_mul_by_3_mod_384_body
DD imagerel $L$SEH_epilogue_mul_by_3_mod_384
DD imagerel $L$SEH_end_mul_by_3_mod_384
DD imagerel $L$SEH_info_mul_by_3_mod_384_epilogue
DD imagerel $L$SEH_begin_mul_by_8_mod_384
DD imagerel $L$SEH_body_mul_by_8_mod_384
DD imagerel $L$SEH_info_mul_by_8_mod_384_prologue
DD imagerel $L$SEH_body_mul_by_8_mod_384
DD imagerel $L$SEH_epilogue_mul_by_8_mod_384
DD imagerel $L$SEH_info_mul_by_8_mod_384_body
DD imagerel $L$SEH_epilogue_mul_by_8_mod_384
DD imagerel $L$SEH_end_mul_by_8_mod_384
DD imagerel $L$SEH_info_mul_by_8_mod_384_epilogue
DD imagerel $L$SEH_begin_mul_by_b_onE1
DD imagerel $L$SEH_body_mul_by_b_onE1
DD imagerel $L$SEH_info_mul_by_b_onE1_prologue
DD imagerel $L$SEH_body_mul_by_b_onE1
DD imagerel $L$SEH_epilogue_mul_by_b_onE1
DD imagerel $L$SEH_info_mul_by_b_onE1_body
DD imagerel $L$SEH_epilogue_mul_by_b_onE1
DD imagerel $L$SEH_end_mul_by_b_onE1
DD imagerel $L$SEH_info_mul_by_b_onE1_epilogue
DD imagerel $L$SEH_begin_mul_by_4b_onE1
DD imagerel $L$SEH_body_mul_by_4b_onE1
DD imagerel $L$SEH_info_mul_by_4b_onE1_prologue
DD imagerel $L$SEH_body_mul_by_4b_onE1
DD imagerel $L$SEH_epilogue_mul_by_4b_onE1
DD imagerel $L$SEH_info_mul_by_4b_onE1_body
DD imagerel $L$SEH_epilogue_mul_by_4b_onE1
DD imagerel $L$SEH_end_mul_by_4b_onE1
DD imagerel $L$SEH_info_mul_by_4b_onE1_epilogue
DD imagerel $L$SEH_begin_mul_by_3_mod_384x
DD imagerel $L$SEH_body_mul_by_3_mod_384x
DD imagerel $L$SEH_info_mul_by_3_mod_384x_prologue
DD imagerel $L$SEH_body_mul_by_3_mod_384x
DD imagerel $L$SEH_epilogue_mul_by_3_mod_384x
DD imagerel $L$SEH_info_mul_by_3_mod_384x_body
DD imagerel $L$SEH_epilogue_mul_by_3_mod_384x
DD imagerel $L$SEH_end_mul_by_3_mod_384x
DD imagerel $L$SEH_info_mul_by_3_mod_384x_epilogue
DD imagerel $L$SEH_begin_mul_by_8_mod_384x
DD imagerel $L$SEH_body_mul_by_8_mod_384x
DD imagerel $L$SEH_info_mul_by_8_mod_384x_prologue
DD imagerel $L$SEH_body_mul_by_8_mod_384x
DD imagerel $L$SEH_epilogue_mul_by_8_mod_384x
DD imagerel $L$SEH_info_mul_by_8_mod_384x_body
DD imagerel $L$SEH_epilogue_mul_by_8_mod_384x
DD imagerel $L$SEH_end_mul_by_8_mod_384x
DD imagerel $L$SEH_info_mul_by_8_mod_384x_epilogue
DD imagerel $L$SEH_begin_mul_by_b_onE2
DD imagerel $L$SEH_body_mul_by_b_onE2
DD imagerel $L$SEH_info_mul_by_b_onE2_prologue
DD imagerel $L$SEH_body_mul_by_b_onE2
DD imagerel $L$SEH_epilogue_mul_by_b_onE2
DD imagerel $L$SEH_info_mul_by_b_onE2_body
DD imagerel $L$SEH_epilogue_mul_by_b_onE2
DD imagerel $L$SEH_end_mul_by_b_onE2
DD imagerel $L$SEH_info_mul_by_b_onE2_epilogue
DD imagerel $L$SEH_begin_mul_by_4b_onE2
DD imagerel $L$SEH_body_mul_by_4b_onE2
DD imagerel $L$SEH_info_mul_by_4b_onE2_prologue
DD imagerel $L$SEH_body_mul_by_4b_onE2
DD imagerel $L$SEH_epilogue_mul_by_4b_onE2
DD imagerel $L$SEH_info_mul_by_4b_onE2_body
DD imagerel $L$SEH_epilogue_mul_by_4b_onE2
DD imagerel $L$SEH_end_mul_by_4b_onE2
DD imagerel $L$SEH_info_mul_by_4b_onE2_epilogue
DD imagerel $L$SEH_begin_cneg_mod_384
DD imagerel $L$SEH_body_cneg_mod_384
DD imagerel $L$SEH_info_cneg_mod_384_prologue
DD imagerel $L$SEH_body_cneg_mod_384
DD imagerel $L$SEH_epilogue_cneg_mod_384
DD imagerel $L$SEH_info_cneg_mod_384_body
DD imagerel $L$SEH_epilogue_cneg_mod_384
DD imagerel $L$SEH_end_cneg_mod_384
DD imagerel $L$SEH_info_cneg_mod_384_epilogue
DD imagerel $L$SEH_begin_sub_mod_384
DD imagerel $L$SEH_body_sub_mod_384
DD imagerel $L$SEH_info_sub_mod_384_prologue
DD imagerel $L$SEH_body_sub_mod_384
DD imagerel $L$SEH_epilogue_sub_mod_384
DD imagerel $L$SEH_info_sub_mod_384_body
DD imagerel $L$SEH_epilogue_sub_mod_384
DD imagerel $L$SEH_end_sub_mod_384
DD imagerel $L$SEH_info_sub_mod_384_epilogue
DD imagerel $L$SEH_begin_sub_mod_384x
DD imagerel $L$SEH_body_sub_mod_384x
DD imagerel $L$SEH_info_sub_mod_384x_prologue
DD imagerel $L$SEH_body_sub_mod_384x
DD imagerel $L$SEH_epilogue_sub_mod_384x
DD imagerel $L$SEH_info_sub_mod_384x_body
DD imagerel $L$SEH_epilogue_sub_mod_384x
DD imagerel $L$SEH_end_sub_mod_384x
DD imagerel $L$SEH_info_sub_mod_384x_epilogue
DD imagerel $L$SEH_begin_mul_by_1_plus_i_mod_384x
DD imagerel $L$SEH_body_mul_by_1_plus_i_mod_384x
DD imagerel $L$SEH_info_mul_by_1_plus_i_mod_384x_prologue
DD imagerel $L$SEH_body_mul_by_1_plus_i_mod_384x
DD imagerel $L$SEH_epilogue_mul_by_1_plus_i_mod_384x
DD imagerel $L$SEH_info_mul_by_1_plus_i_mod_384x_body
DD imagerel $L$SEH_epilogue_mul_by_1_plus_i_mod_384x
DD imagerel $L$SEH_end_mul_by_1_plus_i_mod_384x
DD imagerel $L$SEH_info_mul_by_1_plus_i_mod_384x_epilogue
DD imagerel $L$SEH_begin_sgn0_pty_mod_384
DD imagerel $L$SEH_body_sgn0_pty_mod_384
DD imagerel $L$SEH_info_sgn0_pty_mod_384_prologue
DD imagerel $L$SEH_body_sgn0_pty_mod_384
DD imagerel $L$SEH_epilogue_sgn0_pty_mod_384
DD imagerel $L$SEH_info_sgn0_pty_mod_384_body
DD imagerel $L$SEH_epilogue_sgn0_pty_mod_384
DD imagerel $L$SEH_end_sgn0_pty_mod_384
DD imagerel $L$SEH_info_sgn0_pty_mod_384_epilogue
DD imagerel $L$SEH_begin_sgn0_pty_mod_384x
DD imagerel $L$SEH_body_sgn0_pty_mod_384x
DD imagerel $L$SEH_info_sgn0_pty_mod_384x_prologue
DD imagerel $L$SEH_body_sgn0_pty_mod_384x
DD imagerel $L$SEH_epilogue_sgn0_pty_mod_384x
DD imagerel $L$SEH_info_sgn0_pty_mod_384x_body
DD imagerel $L$SEH_epilogue_sgn0_pty_mod_384x
DD imagerel $L$SEH_end_sgn0_pty_mod_384x
DD imagerel $L$SEH_info_sgn0_pty_mod_384x_epilogue
.pdata ENDS
.xdata SEGMENT READONLY ALIGN(8)
ALIGN 8
$L$SEH_info_add_mod_384_prologue::
DB 1,0,5,00bh
DB 0,074h,1,0
DB 0,064h,2,0
DB 0,003h
DB 0,0
$L$SEH_info_add_mod_384_body::
DB 1,0,17,0
DB 000h,0f4h,001h,000h
DB 000h,0e4h,002h,000h
DB 000h,0d4h,003h,000h
DB 000h,0c4h,004h,000h
DB 000h,034h,005h,000h
DB 000h,054h,006h,000h
DB 000h,074h,008h,000h
DB 000h,064h,009h,000h
DB 000h,062h
DB 000h,000h
$L$SEH_info_add_mod_384_epilogue::
DB 1,0,4,0
DB 000h,074h,001h,000h
DB 000h,064h,002h,000h
DB 000h,000h,000h,000h
$L$SEH_info_add_mod_384x_prologue::
DB 1,0,5,00bh
DB 0,074h,1,0
DB 0,064h,2,0
DB 0,003h
DB 0,0
$L$SEH_info_add_mod_384x_body::
DB 1,0,17,0
DB 000h,0f4h,003h,000h
DB 000h,0e4h,004h,000h
DB 000h,0d4h,005h,000h
DB 000h,0c4h,006h,000h
DB 000h,034h,007h,000h
DB 000h,054h,008h,000h
DB 000h,074h,00ah,000h
DB 000h,064h,00bh,000h
DB 000h,082h
DB 000h,000h
$L$SEH_info_add_mod_384x_epilogue::
DB 1,0,4,0
DB 000h,074h,001h,000h
DB 000h,064h,002h,000h
DB 000h,000h,000h,000h
$L$SEH_info_lshift_mod_384_prologue::
DB 1,0,5,00bh
DB 0,074h,1,0
DB 0,064h,2,0
DB 0,003h
DB 0,0
$L$SEH_info_lshift_mod_384_body::
DB 1,0,17,0
DB 000h,0f4h,001h,000h
DB 000h,0e4h,002h,000h
DB 000h,0d4h,003h,000h
DB 000h,0c4h,004h,000h
DB 000h,034h,005h,000h
DB 000h,054h,006h,000h
DB 000h,074h,008h,000h
DB 000h,064h,009h,000h
DB 000h,062h
DB 000h,000h
$L$SEH_info_lshift_mod_384_epilogue::
DB 1,0,4,0
DB 000h,074h,001h,000h
DB 000h,064h,002h,000h
DB 000h,000h,000h,000h
$L$SEH_info_mul_by_3_mod_384_prologue::
DB 1,0,5,00bh
DB 0,074h,1,0
DB 0,064h,2,0
DB 0,003h
DB 0,0
$L$SEH_info_mul_by_3_mod_384_body::
DB 1,0,17,0
DB 000h,0f4h,001h,000h
DB 000h,0e4h,002h,000h
DB 000h,0d4h,003h,000h
DB 000h,0c4h,004h,000h
DB 000h,034h,005h,000h
DB 000h,054h,006h,000h
DB 000h,074h,008h,000h
DB 000h,064h,009h,000h
DB 000h,062h
DB 000h,000h
$L$SEH_info_mul_by_3_mod_384_epilogue::
DB 1,0,4,0
DB 000h,074h,001h,000h
DB 000h,064h,002h,000h
DB 000h,000h,000h,000h
$L$SEH_info_mul_by_8_mod_384_prologue::
DB 1,0,5,00bh
DB 0,074h,1,0
DB 0,064h,2,0
DB 0,003h
DB 0,0
$L$SEH_info_mul_by_8_mod_384_body::
DB 1,0,17,0
DB 000h,0f4h,001h,000h
DB 000h,0e4h,002h,000h
DB 000h,0d4h,003h,000h
DB 000h,0c4h,004h,000h
DB 000h,034h,005h,000h
DB 000h,054h,006h,000h
DB 000h,074h,008h,000h
DB 000h,064h,009h,000h
DB 000h,062h
DB 000h,000h
$L$SEH_info_mul_by_8_mod_384_epilogue::
DB 1,0,4,0
DB 000h,074h,001h,000h
DB 000h,064h,002h,000h
DB 000h,000h,000h,000h
$L$SEH_info_mul_by_b_onE1_prologue::
DB 1,0,5,00bh
DB 0,074h,1,0
DB 0,064h,2,0
DB 0,003h
DB 0,0
$L$SEH_info_mul_by_b_onE1_body::
DB 1,0,17,0
DB 000h,0f4h,001h,000h
DB 000h,0e4h,002h,000h
DB 000h,0d4h,003h,000h
DB 000h,0c4h,004h,000h
DB 000h,034h,005h,000h
DB 000h,054h,006h,000h
DB 000h,074h,008h,000h
DB 000h,064h,009h,000h
DB 000h,062h
DB 000h,000h
$L$SEH_info_mul_by_b_onE1_epilogue::
DB 1,0,4,0
DB 000h,074h,001h,000h
DB 000h,064h,002h,000h
DB 000h,000h,000h,000h
$L$SEH_info_mul_by_4b_onE1_prologue::
DB 1,0,5,00bh
DB 0,074h,1,0
DB 0,064h,2,0
DB 0,003h
DB 0,0
$L$SEH_info_mul_by_4b_onE1_body::
DB 1,0,17,0
DB 000h,0f4h,001h,000h
DB 000h,0e4h,002h,000h
DB 000h,0d4h,003h,000h
DB 000h,0c4h,004h,000h
DB 000h,034h,005h,000h
DB 000h,054h,006h,000h
DB 000h,074h,008h,000h
DB 000h,064h,009h,000h
DB 000h,062h
DB 000h,000h
$L$SEH_info_mul_by_4b_onE1_epilogue::
DB 1,0,4,0
DB 000h,074h,001h,000h
DB 000h,064h,002h,000h
DB 000h,000h,000h,000h
$L$SEH_info_mul_by_3_mod_384x_prologue::
DB 1,0,5,00bh
DB 0,074h,1,0
DB 0,064h,2,0
DB 0,003h
DB 0,0
$L$SEH_info_mul_by_3_mod_384x_body::
DB 1,0,17,0
DB 000h,0f4h,001h,000h
DB 000h,0e4h,002h,000h
DB 000h,0d4h,003h,000h
DB 000h,0c4h,004h,000h
DB 000h,034h,005h,000h
DB 000h,054h,006h,000h
DB 000h,074h,008h,000h
DB 000h,064h,009h,000h
DB 000h,062h
DB 000h,000h
$L$SEH_info_mul_by_3_mod_384x_epilogue::
DB 1,0,4,0
DB 000h,074h,001h,000h
DB 000h,064h,002h,000h
DB 000h,000h,000h,000h
$L$SEH_info_mul_by_8_mod_384x_prologue::
DB 1,0,5,00bh
DB 0,074h,1,0
DB 0,064h,2,0
DB 0,003h
DB 0,0
$L$SEH_info_mul_by_8_mod_384x_body::
DB 1,0,17,0
DB 000h,0f4h,001h,000h
DB 000h,0e4h,002h,000h
DB 000h,0d4h,003h,000h
DB 000h,0c4h,004h,000h
DB 000h,034h,005h,000h
DB 000h,054h,006h,000h
DB 000h,074h,008h,000h
DB 000h,064h,009h,000h
DB 000h,062h
DB 000h,000h
$L$SEH_info_mul_by_8_mod_384x_epilogue::
DB 1,0,4,0
DB 000h,074h,001h,000h
DB 000h,064h,002h,000h
DB 000h,000h,000h,000h
$L$SEH_info_mul_by_b_onE2_prologue::
DB 1,0,5,00bh
DB 0,074h,1,0
DB 0,064h,2,0
DB 0,003h
DB 0,0
$L$SEH_info_mul_by_b_onE2_body::
DB 1,0,17,0
DB 000h,0f4h,001h,000h
DB 000h,0e4h,002h,000h
DB 000h,0d4h,003h,000h
DB 000h,0c4h,004h,000h
DB 000h,034h,005h,000h
DB 000h,054h,006h,000h
DB 000h,074h,008h,000h
DB 000h,064h,009h,000h
DB 000h,062h
DB 000h,000h
$L$SEH_info_mul_by_b_onE2_epilogue::
DB 1,0,4,0
DB 000h,074h,001h,000h
DB 000h,064h,002h,000h
DB 000h,000h,000h,000h
$L$SEH_info_mul_by_4b_onE2_prologue::
DB 1,0,5,00bh
DB 0,074h,1,0
DB 0,064h,2,0
DB 0,003h
DB 0,0
$L$SEH_info_mul_by_4b_onE2_body::
DB 1,0,17,0
DB 000h,0f4h,001h,000h
DB 000h,0e4h,002h,000h
DB 000h,0d4h,003h,000h
DB 000h,0c4h,004h,000h
DB 000h,034h,005h,000h
DB 000h,054h,006h,000h
DB 000h,074h,008h,000h
DB 000h,064h,009h,000h
DB 000h,062h
DB 000h,000h
$L$SEH_info_mul_by_4b_onE2_epilogue::
DB 1,0,4,0
DB 000h,074h,001h,000h
DB 000h,064h,002h,000h
DB 000h,000h,000h,000h
$L$SEH_info_cneg_mod_384_prologue::
DB 1,0,5,00bh
DB 0,074h,1,0
DB 0,064h,2,0
DB 0,003h
DB 0,0
$L$SEH_info_cneg_mod_384_body::
DB 1,0,17,0
DB 000h,0f4h,001h,000h
DB 000h,0e4h,002h,000h
DB 000h,0d4h,003h,000h
DB 000h,0c4h,004h,000h
DB 000h,034h,005h,000h
DB 000h,054h,006h,000h
DB 000h,074h,008h,000h
DB 000h,064h,009h,000h
DB 000h,062h
DB 000h,000h
$L$SEH_info_cneg_mod_384_epilogue::
DB 1,0,4,0
DB 000h,074h,001h,000h
DB 000h,064h,002h,000h
DB 000h,000h,000h,000h
$L$SEH_info_sub_mod_384_prologue::
DB 1,0,5,00bh
DB 0,074h,1,0
DB 0,064h,2,0
DB 0,003h
DB 0,0
$L$SEH_info_sub_mod_384_body::
DB 1,0,17,0
DB 000h,0f4h,001h,000h
DB 000h,0e4h,002h,000h
DB 000h,0d4h,003h,000h
DB 000h,0c4h,004h,000h
DB 000h,034h,005h,000h
DB 000h,054h,006h,000h
DB 000h,074h,008h,000h
DB 000h,064h,009h,000h
DB 000h,062h
DB 000h,000h
$L$SEH_info_sub_mod_384_epilogue::
DB 1,0,4,0
DB 000h,074h,001h,000h
DB 000h,064h,002h,000h
DB 000h,000h,000h,000h
$L$SEH_info_sub_mod_384x_prologue::
DB 1,0,5,00bh
DB 0,074h,1,0
DB 0,064h,2,0
DB 0,003h
DB 0,0
$L$SEH_info_sub_mod_384x_body::
DB 1,0,17,0
DB 000h,0f4h,003h,000h
DB 000h,0e4h,004h,000h
DB 000h,0d4h,005h,000h
DB 000h,0c4h,006h,000h
DB 000h,034h,007h,000h
DB 000h,054h,008h,000h
DB 000h,074h,00ah,000h
DB 000h,064h,00bh,000h
DB 000h,082h
DB 000h,000h
$L$SEH_info_sub_mod_384x_epilogue::
DB 1,0,4,0
DB 000h,074h,001h,000h
DB 000h,064h,002h,000h
DB 000h,000h,000h,000h
$L$SEH_info_mul_by_1_plus_i_mod_384x_prologue::
DB 1,0,5,00bh
DB 0,074h,1,0
DB 0,064h,2,0
DB 0,003h
DB 0,0
$L$SEH_info_mul_by_1_plus_i_mod_384x_body::
DB 1,0,17,0
DB 000h,0f4h,007h,000h
DB 000h,0e4h,008h,000h
DB 000h,0d4h,009h,000h
DB 000h,0c4h,00ah,000h
DB 000h,034h,00bh,000h
DB 000h,054h,00ch,000h
DB 000h,074h,00eh,000h
DB 000h,064h,00fh,000h
DB 000h,0c2h
DB 000h,000h
$L$SEH_info_mul_by_1_plus_i_mod_384x_epilogue::
DB 1,0,4,0
DB 000h,074h,001h,000h
DB 000h,064h,002h,000h
DB 000h,000h,000h,000h
$L$SEH_info_sgn0_pty_mod_384_prologue::
DB 1,0,5,00bh
DB 0,074h,1,0
DB 0,064h,2,0
DB 0,003h
DB 0,0
$L$SEH_info_sgn0_pty_mod_384_body::
DB 1,0,4,0
DB 000h,074h,001h,000h
DB 000h,064h,002h,000h
DB 000h,000h,000h,000h
$L$SEH_info_sgn0_pty_mod_384_epilogue::
DB 1,0,4,0
DB 000h,074h,001h,000h
DB 000h,064h,002h,000h
DB 000h,000h,000h,000h
$L$SEH_info_sgn0_pty_mod_384x_prologue::
DB 1,0,5,00bh
DB 0,074h,1,0
DB 0,064h,2,0
DB 0,003h
DB 0,0
$L$SEH_info_sgn0_pty_mod_384x_body::
DB 1,0,9,0
DB 000h,034h,001h,000h
DB 000h,054h,002h,000h
DB 000h,074h,004h,000h
DB 000h,064h,005h,000h
DB 000h,022h
DB 000h,000h
$L$SEH_info_sgn0_pty_mod_384x_epilogue::
DB 1,0,4,0
DB 000h,074h,001h,000h
DB 000h,064h,002h,000h
DB 000h,000h,000h,000h
.xdata ENDS
END
| 17.828011 | 58 | 0.750096 | [
"Apache-2.0"
] | michaelsproul/blst | build/win64/add_mod_384-x86_64.asm | 39,079 | Assembly |
; A195241: Expansion of (1-x+19*x^3-3*x^4)/(1-x)^3.
; 1,2,3,23,59,111,179,263,363,479,611,759,923,1103,1299,1511,1739,1983,2243,2519,2811,3119,3443,3783,4139,4511,4899,5303,5723,6159,6611,7079,7563,8063,8579,9111,9659,10223,10803,11399,12011,12639,13283,13943,14619,15311,16019,16743,17483,18239,19011,19799,20603,21423,22259,23111,23979,24863,25763,26679,27611,28559,29523,30503,31499,32511,33539,34583,35643,36719,37811,38919,40043,41183,42339,43511,44699,45903,47123,48359,49611,50879,52163,53463,54779,56111,57459,58823,60203,61599,63011,64439,65883,67343,68819,70311,71819,73343,74883,76439,78011,79599,81203,82823,84459,86111,87779,89463,91163,92879,94611,96359,98123,99903,101699,103511,105339,107183,109043,110919,112811,114719,116643,118583,120539,122511,124499,126503,128523,130559,132611,134679,136763,138863,140979,143111,145259,147423,149603,151799,154011,156239,158483,160743,163019,165311,167619,169943,172283,174639,177011,179399,181803,184223,186659,189111,191579,194063,196563,199079,201611,204159,206723,209303,211899,214511,217139,219783,222443,225119,227811,230519,233243,235983,238739,241511,244299,247103,249923,252759,255611,258479,261363,264263,267179,270111,273059,276023,279003,281999,285011,288039,291083,294143,297219,300311,303419,306543,309683,312839,316011,319199,322403,325623,328859,332111,335379,338663,341963,345279,348611,351959,355323,358703,362099,365511,368939,372383,375843,379319,382811,386319,389843,393383,396939,400511,404099,407703,411323,414959,418611,422279,425963,429663,433379,437111,440859,444623,448403,452199,456011,459839,463683,467543,471419,475311,479219,483143,487083,491039
mov $1,$0
trn $1,2
mov $2,$0
add $2,$1
add $2,2
mov $0,$2
sub $0,4
mov $1,$2
mov $3,$2
add $3,$2
sub $3,3
lpb $0,1
sub $0,1
add $1,$3
lpe
sub $1,1
| 89.2 | 1,579 | 0.804933 | [
"Apache-2.0"
] | karttu/loda | programs/oeis/195/A195241.asm | 1,784 | Assembly |
;
; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
;
; Use of this source code is governed by a BSD-style license
; that can be found in the LICENSE file in the root of the source
; tree. An additional intellectual property rights grant can be found
; in the file PATENTS. All contributing project authors may
; be found in the AUTHORS file in the root of the source tree.
;
%include "third_party/x86inc/x86inc.asm"
SECTION .text
%macro convolve_fn 1-2
%ifidn %1, avg
%define AUX_XMM_REGS 4
%else
%define AUX_XMM_REGS 0
%endif
%ifidn %2, highbd
%define pavg pavgw
cglobal %2_convolve_%1, 4, 7, 4+AUX_XMM_REGS, src, src_stride, \
dst, dst_stride, \
fx, fxs, fy, fys, w, h, bd
%else
%define pavg pavgb
cglobal convolve_%1, 4, 7, 4+AUX_XMM_REGS, src, src_stride, \
dst, dst_stride, \
fx, fxs, fy, fys, w, h
%endif
mov r4d, dword wm
%ifidn %2, highbd
shl r4d, 1
shl src_strideq, 1
shl dst_strideq, 1
%else
cmp r4d, 4
je .w4
%endif
cmp r4d, 8
je .w8
cmp r4d, 16
je .w16
cmp r4d, 32
je .w32
%ifidn %2, highbd
cmp r4d, 64
je .w64
mov r4d, dword hm
.loop128:
movu m0, [srcq]
movu m1, [srcq+16]
movu m2, [srcq+32]
movu m3, [srcq+48]
%ifidn %1, avg
pavg m0, [dstq]
pavg m1, [dstq+16]
pavg m2, [dstq+32]
pavg m3, [dstq+48]
%endif
mova [dstq ], m0
mova [dstq+16], m1
mova [dstq+32], m2
mova [dstq+48], m3
movu m0, [srcq+64]
movu m1, [srcq+80]
movu m2, [srcq+96]
movu m3, [srcq+112]
add srcq, src_strideq
%ifidn %1, avg
pavg m0, [dstq+64]
pavg m1, [dstq+80]
pavg m2, [dstq+96]
pavg m3, [dstq+112]
%endif
mova [dstq+64], m0
mova [dstq+80], m1
mova [dstq+96], m2
mova [dstq+112], m3
add dstq, dst_strideq
dec r4d
jnz .loop128
RET
%endif
.w64:
mov r4d, dword hm
.loop64:
movu m0, [srcq]
movu m1, [srcq+16]
movu m2, [srcq+32]
movu m3, [srcq+48]
add srcq, src_strideq
%ifidn %1, avg
pavg m0, [dstq]
pavg m1, [dstq+16]
pavg m2, [dstq+32]
pavg m3, [dstq+48]
%endif
mova [dstq ], m0
mova [dstq+16], m1
mova [dstq+32], m2
mova [dstq+48], m3
add dstq, dst_strideq
dec r4d
jnz .loop64
RET
.w32:
mov r4d, dword hm
.loop32:
movu m0, [srcq]
movu m1, [srcq+16]
movu m2, [srcq+src_strideq]
movu m3, [srcq+src_strideq+16]
lea srcq, [srcq+src_strideq*2]
%ifidn %1, avg
pavg m0, [dstq]
pavg m1, [dstq +16]
pavg m2, [dstq+dst_strideq]
pavg m3, [dstq+dst_strideq+16]
%endif
mova [dstq ], m0
mova [dstq +16], m1
mova [dstq+dst_strideq ], m2
mova [dstq+dst_strideq+16], m3
lea dstq, [dstq+dst_strideq*2]
sub r4d, 2
jnz .loop32
RET
.w16:
mov r4d, dword hm
lea r5q, [src_strideq*3]
lea r6q, [dst_strideq*3]
.loop16:
movu m0, [srcq]
movu m1, [srcq+src_strideq]
movu m2, [srcq+src_strideq*2]
movu m3, [srcq+r5q]
lea srcq, [srcq+src_strideq*4]
%ifidn %1, avg
pavg m0, [dstq]
pavg m1, [dstq+dst_strideq]
pavg m2, [dstq+dst_strideq*2]
pavg m3, [dstq+r6q]
%endif
mova [dstq ], m0
mova [dstq+dst_strideq ], m1
mova [dstq+dst_strideq*2], m2
mova [dstq+r6q ], m3
lea dstq, [dstq+dst_strideq*4]
sub r4d, 4
jnz .loop16
RET
.w8:
mov r4d, dword hm
lea r5q, [src_strideq*3]
lea r6q, [dst_strideq*3]
.loop8:
movh m0, [srcq]
movh m1, [srcq+src_strideq]
movh m2, [srcq+src_strideq*2]
movh m3, [srcq+r5q]
lea srcq, [srcq+src_strideq*4]
%ifidn %1, avg
movh m4, [dstq]
movh m5, [dstq+dst_strideq]
movh m6, [dstq+dst_strideq*2]
movh m7, [dstq+r6q]
pavg m0, m4
pavg m1, m5
pavg m2, m6
pavg m3, m7
%endif
movh [dstq ], m0
movh [dstq+dst_strideq ], m1
movh [dstq+dst_strideq*2], m2
movh [dstq+r6q ], m3
lea dstq, [dstq+dst_strideq*4]
sub r4d, 4
jnz .loop8
RET
%ifnidn %2, highbd
.w4:
mov r4d, dword hm
lea r5q, [src_strideq*3]
lea r6q, [dst_strideq*3]
.loop4:
movd m0, [srcq]
movd m1, [srcq+src_strideq]
movd m2, [srcq+src_strideq*2]
movd m3, [srcq+r5q]
lea srcq, [srcq+src_strideq*4]
%ifidn %1, avg
movd m4, [dstq]
movd m5, [dstq+dst_strideq]
movd m6, [dstq+dst_strideq*2]
movd m7, [dstq+r6q]
pavg m0, m4
pavg m1, m5
pavg m2, m6
pavg m3, m7
%endif
movd [dstq ], m0
movd [dstq+dst_strideq ], m1
movd [dstq+dst_strideq*2], m2
movd [dstq+r6q ], m3
lea dstq, [dstq+dst_strideq*4]
sub r4d, 4
jnz .loop4
RET
%endif
%endmacro
INIT_XMM sse2
convolve_fn copy
convolve_fn avg
%if CONFIG_VP9_HIGHBITDEPTH
convolve_fn copy, highbd
convolve_fn avg, highbd
%endif
| 29.246696 | 72 | 0.43365 | [
"MIT"
] | MarilynDafa/Bulllord-Engine | plugins/video/webm/vpx_dsp/x86/vpx_convolve_copy_sse2.asm | 6,639 | Assembly |
;在屏幕中间分别显示绿色、绿底红色、白底蓝色的字符串
assume ds:datasg,cs:codesg
datasg segment
db 'Hello World!' ;待输出的数据
datasg ends
codesg segment
start:
mov ax,0b804h ;横向“中间”内存地址
mov ds,ax
mov ax,datasg
mov es,ax
mov si,0
mov bx,160*12 ;纵向“中间”内存地址
mov cx,0ch ;12个字节
s:
mov al,es:[si] ;逐字送入显存的内存地址
mov ah,00000111b ;效果
mov ds:[bx],ax ;将效果送入显存地址
mov ah,01110001b
mov ds:[bx+160],ax ;换行
mov ah,11000010b
mov ds:[bx+160*2],ax ;再换行
inc si ;下一个字节
add bx,2
loop s ;循环逐字输出
mov ax,4c00h
int 21h
codesg ends
end start | 14.153846 | 31 | 0.650362 | [
"MIT"
] | jckling/CUC-Courses | 汇编语言/第9章/9.asm | 736 | Assembly |
#include "Mcu.inc"
radix decimal
config FOSC=INTRCIO
config WDTE=OFF
config PWRTE=ON
config MCLRE=ON
config CP=OFF
config CPD=OFF
config BOREN=SBODEN
config IESO=OFF
config FCMEN=OFF
end
| 12.625 | 20 | 0.747525 | [
"MIT"
] | pete-restall/Cluck2Sesame-Prototype | src/firmware/ConfigWords.asm | 202 | Assembly |
; attribute line offsets in the VRAM to control-key position
KEY_ATTR_OFS_HELP equ 0
KEY_ATTR_OFS_TURBO equ 5
KEY_ATTR_OFS_FULL equ 10
KEY_ATTR_OFS_RUN equ 15
KEY_ATTR_OFS_CORE equ 22
KEY_ATTR_OFS_INSTR equ 27
CHARPOS_INS_END equ 13
CHARPOS_ENCODING equ 15
CHARPOS_INS_KEY equ KEY_ATTR_OFS_INSTR
CHARPOS_STATUS equ 29
MachineInfoLabels:
; 0123456789A123456789A123456789A1
db '1Hlp 2T28 3Ful 5Go m',0,'c',0
InstructionMnemonics:
db 'ADD BC,**',0
db 'ADD BC,A',0
db 'ADD DE,**',0
db 'ADD DE,A',0
db 'ADD HL,**',0
db 'ADD HL,A',0
db 'LDDRX',0
db 'LDDX',0
db 'LDIRX',0
db 'LDIX',0
db 'LDPIRX',0
db 'LDWS',0
db 'MIRROR',0
db 'MUL D,E',0
db 'NEXTREG *r,*n',0
db 'NEXTREG *r,A',0
db 'OUTINB',0
db 'PIXELAD',0
db 'PIXELDN',0
db 'PUSH **',0
db 'SETAE',0
db 'SWAPNIB',0
db 'TEST *',0
; Two bytes per instruction: Char to display, location in key-array to test
InstructionsData_KeyLegends:
db 'Q', KEY_Q ; ADD BC,$nnnn
db 'W', KEY_W ; ADD BC,A
db 'E', KEY_E ; ADD DE,$nnnn
db 'R', KEY_R ; ADD DE,A
db 'T', KEY_T ; ADD HL,$nnnn
db 'Y', KEY_Y ; ADD HL,A
db 'U', KEY_U ; LDDRX
db 'I', KEY_I ; LDDX
db 'O', KEY_O ; LDIRX
db 'P', KEY_P ; LDIX
db 'A', KEY_A ; LDPIRX
db 'S', KEY_S ; LDWS
db 'D', KEY_D ; MIRROR
db 'F', KEY_F ; MUL D,E
db 'G', KEY_G ; NEXTREG $rr,$n
db 'H', KEY_H ; NEXTREG $rr,A
db 'J', KEY_J ; OUTINB
db 'K', KEY_K ; PIXELAD
db 'L', KEY_L ; PIXELDN
db 'Z', KEY_Z ; PUSH $nnnn
db 'X', KEY_X ; SETAE
db 'C', KEY_C ; SWAPNIB
db 'V', KEY_V ; TEST $nn
; four bytes per instruction, either real opcode byte, or special opcode equ
InstructionsData_Encoding:
db $ED, $36, OPCODE_TXT_LOW, OPCODE_TXT_HIGH ; ADD BC,$nnnn
db $ED, $33, 0, 0 ; ADD BC,A
db $ED, $35, OPCODE_TXT_LOW, OPCODE_TXT_HIGH ; ADD DE,$nnnn
db $ED, $32, 0, 0 ; ADD DE,A
db $ED, $34, OPCODE_TXT_LOW, OPCODE_TXT_HIGH ; ADD HL,$nnnn
db $ED, $31, 0, 0 ; ADD HL,A
db $ED, $BC, 0, 0 ; LDDRX
db $ED, $AC, 0, 0 ; LDDX
db $ED, $B4, 0, 0 ; LDIRX
db $ED, $A4, 0, 0 ; LDIX
db $ED, $B7, 0, 0 ; LDPIRX
db $ED, $A5, 0, 0 ; LDWS
db $ED, $24, 0, 0 ; MIRROR
db $ED, $30, 0, 0 ; MUL D,E
db $ED, $91, OPCODE_TXT_REG, OPCODE_TXT_VALUE ; NEXTREG $rr,$n
db $ED, $92, OPCODE_TXT_REG, 0 ; NEXTREG $rr,A
db $ED, $90, 0, 0 ; OUTINB
db $ED, $94, 0, 0 ; PIXELAD
db $ED, $93, 0, 0 ; PIXELDN
db $ED, $8A, OPCODE_TXT_HIGH, OPCODE_TXT_LOW ; PUSH $nnnn
db $ED, $95, 0, 0 ; SETAE
db $ED, $23, 0, 0 ; SWAPNIB
db $ED, $27, OPCODE_TXT_VALUE, 0 ; TEST $nn
; byte 0 = encoding bytes [2:0], special mask [7:3] (from top to bottom)
; byte 1 = result
; byte 2 = logIndex (first log index, 0 == no log)
; byte 3 = temporary scratch area for test
InstructionsData_Details:
db $34, RESULT_NONE, 0, -1 ; ADD BC,$nnnn
db $02, RESULT_NONE, 0, -1 ; ADD BC,A
db $34, RESULT_NONE, 0, -1 ; ADD DE,$nnnn
db $02, RESULT_NONE, 0, -1 ; ADD DE,A
db $34, RESULT_NONE, 0, -1 ; ADD HL,$nnnn
db $02, RESULT_NONE, 0, -1 ; ADD HL,A
db $02, RESULT_NONE, 0, -1 ; LDDRX
db $02, RESULT_NONE, 0, -1 ; LDDX
db $02, RESULT_NONE, 0, -1 ; LDIRX
db $02, RESULT_NONE, 0, -1 ; LDIX
db $02, RESULT_NONE, 0, -1 ; LDPIRX
db $02, RESULT_NONE, 0, -1 ; LDWS
db $02, RESULT_NONE, 0, -1 ; MIRROR
db $02, RESULT_NONE, 0, -1 ; MUL D,E
db $34, RESULT_NONE, 0, -1 ; NEXTREG $rr,$n
db $23, RESULT_NONE, 0, -1 ; NEXTREG $rr,A
db $02, RESULT_NONE, 0, -1 ; OUTINB
db $02, RESULT_NONE, 0, -1 ; PIXELAD
db $02, RESULT_NONE, 0, -1 ; PIXELDN
db $34, RESULT_NONE, 0, -1 ; PUSH $nnnn
db $02, RESULT_NONE, 0, -1 ; SETAE
db $02, RESULT_NONE, 0, -1 ; SWAPNIB
db $23, RESULT_NONE, 0, -1 ; TEST $nn
HelpTxt:
; 0123456789A123456789A123456789A1
db ' ',0
db 'Read the "!Z80N.txt" for details',0
db ' ',0
db 'Press 2 to switch 28Mhz turbo.',0
db 'Press 5 to run all tests (~6s).',0
db 'Option 3 for full tests (~3min).',0
db ' ',0
db 'To run particular test or check',0
db 'error log in case of "ERR" state',0
db 'press the highlighted letter.',0
db ' ',0
db 'Values in log are hexadecimal.',0
db ' ',0
db 'For instruction details you can',0
db 'check:',0
db 'https://wiki.specnext.dev/Extend',0
db 'ed_Z80_instruction_set',0
db ' ',0
db 'Tests can be run only once.',0
db ' ',0
db ' Press any key',0
db 0
include "UIcode.i.asm"
| 44.546667 | 80 | 0.401526 | [
"MIT"
] | MrKWatkins/ZXSpectrumNextTests | Tests/base/Z80N/UI.i.asm | 6,682 | Assembly |
;
; Galaksija libraries
;
;--------------------------------------------------------------
; This code comes from the FidoNET Sinclair newsgroup
;--------------------------------------------------------------
;
; $Id: invtxt.asm $
;
;----------------------------------------------------------------
;
; invtxt() - invert text display
;
;----------------------------------------------------------------
SECTION code_clib
PUBLIC invtxt
PUBLIC _invtxt
invtxt:
_invtxt:
ld hl,$2800 ; DFILE ADDR
ld bc,32*16
LD A,(HL) ; DFILE CHAR
XOR 80H ; ** invert it **
LD (HL),A ; POKE DFILE
dec bc
ld a,b
or c
jr nz,invtxt
ret
| 24.125 | 65 | 0.313472 | [
"BSD-2-Clause"
] | ByteProject/Puddle-BuildTools | FictionTools/z88dk/libsrc/target/gal/invtxt.asm | 772 | Assembly |
.MODEL small
.STACK
.DATA
num db -50
.CODE
.STARTUP
mov al,num
rcl al,1
jb next
mov dl,00h
.EXIT
next: mov dl,01h
.EXIT
end | 8.857143 | 16 | 0.709677 | [
"MIT"
] | kaazima/Emulator-8086 | Source Codes/Positive or Negative.asm | 124 | Assembly |
global to_binary
section .text
; <--- unsigned long long to_binary(unsigned short num) --->
to_binary:
mov rax, 1
xor rdx, rdx ; rdx:rax "10-value" of current bit
mov r8, 10
xor r9, r9 ; sum up the result in r9
.loop:
shr rdi, 1 ; check current bit
jnc .digit0
add r9, rax ; bit is set => add current 10-value
.digit0:
mul r8 ; 10 value of next bit
test rdi, rdi
jnz .loop ; repeat until all bits handled
mov rax, r9
ret
; -----> end of tobin <----- | 27.047619 | 60 | 0.540493 | [
"MIT"
] | UlrichBerntien/Codewars-Katas | 8_kyu/Convert_to_Binary.asm | 568 | Assembly |
; $Id: ASMGetIdtrLimit.asm $
;; @file
; IPRT - ASMGetIdtrLimit().
;
;
; Copyright (C) 2006-2015 Oracle Corporation
;
; This file is part of VirtualBox Open Source Edition (OSE), as
; available from http://www.virtualbox.org. This file is free software;
; you can redistribute it and/or modify it under the terms of the GNU
; General Public License (GPL) as published by the Free Software
; Foundation, in version 2 as it comes in the "COPYING" file of the
; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
;
; The contents of this file may alternatively be used under the terms
; of the Common Development and Distribution License Version 1.0
; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
; VirtualBox OSE distribution, in which case the provisions of the
; CDDL are applicable instead of those of the GPL.
;
; You may elect to license modified versions of this file under the
; terms and conditions of either the GPL or the CDDL or both.
;
;*******************************************************************************
;* Header Files *
;*******************************************************************************
%define RT_ASM_WITH_SEH64
%include "iprt/asmdefs.mac"
BEGINCODE
;;
; Gets the content of the IDTR CPU register.
; @returns IDTR.LIMIT in ax
;
BEGINPROC_EXPORTED ASMGetIdtrLimit
sub xSP, 18h
SEH64_ALLOCATE_STACK 18h
SEH64_END_PROLOGUE
sidt [xSP + 6]
mov ax, [xSP + 6]
add xSP, 18h
ret
ENDPROC ASMGetIdtrLimit
| 33.938776 | 80 | 0.625977 | [
"MIT"
] | egraba/vbox_openbsd | VirtualBox-5.0.0/src/VBox/Runtime/common/asm/ASMGetIdtrLimit.asm | 1,663 | Assembly |
; A177339: Partial sums of round(n^2/44).
; 0,0,0,0,0,1,2,3,4,6,8,11,14,18,22,27,33,40,47,55,64,74,85,97,110,124,139,156,174,193,213,235,258,283,309,337,366,397,430,465,501,539,579,621,665,711,759,809,861,916,973,1032,1093,1157,1223,1292,1363,1437,1513,1592,1674,1759,1846,1936,2029,2125,2224,2326,2431,2539,2650,2765,2883,3004,3128,3256,3387,3522,3660,3802,3947,4096,4249,4406,4566,4730,4898,5070,5246,5426,5610,5798,5990,6187,6388,6593,6802,7016,7234,7457,7684,7916,8152,8393,8639,8890,9145,9405,9670,9940,10215,10495,10780,11070,11365,11666,11972,12283,12599,12921,13248,13581,13919,14263,14612,14967,15328,15695,16067,16445,16829,17219,17615,18017,18425,18839,19259,19686,20119,20558,21003,21455,21913,22378,22849,23327,23811,24302,24800,25305,25816,26334,26859,27391,27930,28476,29029,29589,30156,30731,31313,31902,32498,33102,33713,34332,34958,35592,36233,36882,37539,38204,38876,39556,40244,40940,41644,42356,43076,43804,44540,45285,46038,46799,47568,48346,49132,49927,50730,51542,52362,53191,54029,54876,55731,56595,57468,58350,59241,60141,61050,61968,62895,63832,64778,65733,66697,67671,68654,69647,70649,71661,72682,73713,74754,75805,76865,77935,79015,80105,81205,82315,83435,84565,85705,86856,88017,89188,90369,91561,92763,93976,95199,96433,97677,98932,100198,101475,102762,104060,105369,106689,108020,109362,110715,112079,113454,114841,116239,117648
mov $2,$0
mov $4,$0
lpb $2
mov $0,$4
sub $2,1
sub $0,$2
pow $0,2
mov $3,22
add $3,$0
mov $5,$3
div $5,44
add $1,$5
lpe
| 88.235294 | 1,319 | 0.774 | [
"Apache-2.0"
] | jmorken/loda | programs/oeis/177/A177339.asm | 1,500 | Assembly |
; A259665: a(0)=0, a(1)=1, a(n) = min{4 a(k) + (4^(n-k)-1)/3, k=0..(n-1)} for n>=2.
; 0,1,5,9,25,41,57,121,185,249,313,569,825,1081,1337,1593,2617,3641,4665,5689,6713,7737,11833,15929,20025,24121,28217,32313,36409,52793,69177,85561,101945,118329,134713,151097,167481,233017,298553,364089,429625,495161,560697,626233,691769,757305,1019449,1281593,1543737,1805881,2068025,2330169,2592313,2854457,3116601,3378745,4427321,5475897,6524473,7573049,8621625,9670201,10718777,11767353,12815929,13864505,14913081,19107385,23301689,27495993,31690297,35884601,40078905,44273209,48467513,52661817,56856121,61050425,65244729,82021945,98799161,115576377,132353593,149130809,165908025,182685241,199462457,216239673,233016889,249794105,266571321,283348537,350457401,417566265,484675129,551783993,618892857,686001721,753110585,820219449,887328313,954437177,1021546041,1088654905,1155763769,1222872633,1491308089,1759743545,2028179001,2296614457,2565049913,2833485369,3101920825,3370356281,3638791737,3907227193,4175662649,4444098105,4712533561,4980969017,5249404473,6323146297,7396888121,8470629945,9544371769,10618113593,11691855417,12765597241,13839339065,14913080889,15986822713,17060564537,18134306361,19208048185,20281790009,21355531833,22429273657,26724240953,31019208249,35314175545,39609142841,43904110137,48199077433,52494044729,56789012025,61083979321,65378946617,69673913913,73968881209,78263848505,82558815801,86853783097,91148750393,95443717689,112623586873,129803456057,146983325241,164163194425,181343063609,198522932793,215702801977,232882671161,250062540345,267242409529,284422278713,301602147897,318782017081,335961886265,353141755449,370321624633,387501493817,404681363001,473400839737,542120316473,610839793209,679559269945,748278746681,816998223417,885717700153,954437176889,1023156653625,1091876130361,1160595607097,1229315083833,1298034560569,1366754037305,1435473514041,1504192990777,1572912467513,1641631944249,1710351420985,1985229327929,2260107234873,2534985141817,2809863048761,3084740955705,3359618862649,3634496769593,3909374676537,4184252583481,4459130490425,4734008397369,5008886304313,5283764211257,5558642118201,5833520025145,6108397932089,6383275839033,6658153745977,6933031652921,7207909559865,8307421187641,9406932815417,10506444443193,11605956070969,12705467698745,13804979326521,14904490954297,16004002582073,17103514209849,18203025837625,19302537465401,20402049093177,21501560720953,22601072348729,23700583976505,24800095604281,25899607232057,26999118859833,28098630487609,29198142115385,30297653743161,34695700254265,39093746765369,43491793276473,47889839787577,52287886298681,56685932809785,61083979320889,65482025831993,69880072343097,74278118854201,78676165365305,83074211876409,87472258387513,91870304898617,96268351409721,100666397920825,105064444431929,109462490943033
mov $7,$0
mov $9,$0
lpb $9,1
mov $0,$7
sub $9,1
sub $0,$9
lpb $2,1
add $0,1
mov $3,$2
mov $5,$2
add $5,1
mov $6,$0
mul $0,$4
add $6,$2
sub $6,3
lpb $6,1
add $3,1
trn $6,$3
lpe
mov $2,$0
sub $3,1
mov $8,$5
mul $8,2
lpe
add $2,1
pow $8,$3
add $1,$8
lpe
| 97.9375 | 2,713 | 0.839502 | [
"Apache-2.0"
] | karttu/loda | programs/oeis/259/A259665.asm | 3,134 | Assembly |
_rm: formato de ficheiro elf32-i386
Desmontagem da secção .text:
00000000 <main>:
#include "stat.h"
#include "user.h"
int
main(int argc, char *argv[])
{
0: 8d 4c 24 04 lea 0x4(%esp),%ecx
4: 83 e4 f0 and $0xfffffff0,%esp
7: ff 71 fc pushl -0x4(%ecx)
a: 55 push %ebp
b: 89 e5 mov %esp,%ebp
d: 53 push %ebx
e: 51 push %ecx
f: 83 ec 10 sub $0x10,%esp
12: 89 cb mov %ecx,%ebx
int i;
if(argc < 2){
14: 83 3b 01 cmpl $0x1,(%ebx)
17: 7f 17 jg 30 <main+0x30>
printf(2, "Usage: rm files...\n");
19: 83 ec 08 sub $0x8,%esp
1c: 68 10 08 00 00 push $0x810
21: 6a 02 push $0x2
23: e8 32 04 00 00 call 45a <printf>
28: 83 c4 10 add $0x10,%esp
exit();
2b: e8 b7 02 00 00 call 2e7 <exit>
}
for(i = 1; i < argc; i++){
30: c7 45 f4 01 00 00 00 movl $0x1,-0xc(%ebp)
37: eb 4b jmp 84 <main+0x84>
if(unlink(argv[i]) < 0){
39: 8b 45 f4 mov -0xc(%ebp),%eax
3c: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
43: 8b 43 04 mov 0x4(%ebx),%eax
46: 01 d0 add %edx,%eax
48: 8b 00 mov (%eax),%eax
4a: 83 ec 0c sub $0xc,%esp
4d: 50 push %eax
4e: e8 e4 02 00 00 call 337 <unlink>
53: 83 c4 10 add $0x10,%esp
56: 85 c0 test %eax,%eax
58: 79 26 jns 80 <main+0x80>
printf(2, "rm: %s failed to delete\n", argv[i]);
5a: 8b 45 f4 mov -0xc(%ebp),%eax
5d: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
64: 8b 43 04 mov 0x4(%ebx),%eax
67: 01 d0 add %edx,%eax
69: 8b 00 mov (%eax),%eax
6b: 83 ec 04 sub $0x4,%esp
6e: 50 push %eax
6f: 68 24 08 00 00 push $0x824
74: 6a 02 push $0x2
76: e8 df 03 00 00 call 45a <printf>
7b: 83 c4 10 add $0x10,%esp
break;
7e: eb 0b jmp 8b <main+0x8b>
for(i = 1; i < argc; i++){
80: 83 45 f4 01 addl $0x1,-0xc(%ebp)
84: 8b 45 f4 mov -0xc(%ebp),%eax
87: 3b 03 cmp (%ebx),%eax
89: 7c ae jl 39 <main+0x39>
}
}
exit();
8b: e8 57 02 00 00 call 2e7 <exit>
00000090 <stosb>:
"cc");
}
static inline void
stosb(void *addr, int data, int cnt)
{
90: 55 push %ebp
91: 89 e5 mov %esp,%ebp
93: 57 push %edi
94: 53 push %ebx
asm volatile("cld; rep stosb" :
95: 8b 4d 08 mov 0x8(%ebp),%ecx
98: 8b 55 10 mov 0x10(%ebp),%edx
9b: 8b 45 0c mov 0xc(%ebp),%eax
9e: 89 cb mov %ecx,%ebx
a0: 89 df mov %ebx,%edi
a2: 89 d1 mov %edx,%ecx
a4: fc cld
a5: f3 aa rep stos %al,%es:(%edi)
a7: 89 ca mov %ecx,%edx
a9: 89 fb mov %edi,%ebx
ab: 89 5d 08 mov %ebx,0x8(%ebp)
ae: 89 55 10 mov %edx,0x10(%ebp)
"=D" (addr), "=c" (cnt) :
"0" (addr), "1" (cnt), "a" (data) :
"memory", "cc");
}
b1: 90 nop
b2: 5b pop %ebx
b3: 5f pop %edi
b4: 5d pop %ebp
b5: c3 ret
000000b6 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, char *t)
{
b6: 55 push %ebp
b7: 89 e5 mov %esp,%ebp
b9: 83 ec 10 sub $0x10,%esp
char *os;
os = s;
bc: 8b 45 08 mov 0x8(%ebp),%eax
bf: 89 45 fc mov %eax,-0x4(%ebp)
while((*s++ = *t++) != 0)
c2: 90 nop
c3: 8b 55 0c mov 0xc(%ebp),%edx
c6: 8d 42 01 lea 0x1(%edx),%eax
c9: 89 45 0c mov %eax,0xc(%ebp)
cc: 8b 45 08 mov 0x8(%ebp),%eax
cf: 8d 48 01 lea 0x1(%eax),%ecx
d2: 89 4d 08 mov %ecx,0x8(%ebp)
d5: 0f b6 12 movzbl (%edx),%edx
d8: 88 10 mov %dl,(%eax)
da: 0f b6 00 movzbl (%eax),%eax
dd: 84 c0 test %al,%al
df: 75 e2 jne c3 <strcpy+0xd>
;
return os;
e1: 8b 45 fc mov -0x4(%ebp),%eax
}
e4: c9 leave
e5: c3 ret
000000e6 <strcmp>:
int
strcmp(const char *p, const char *q)
{
e6: 55 push %ebp
e7: 89 e5 mov %esp,%ebp
while(*p && *p == *q)
e9: eb 08 jmp f3 <strcmp+0xd>
p++, q++;
eb: 83 45 08 01 addl $0x1,0x8(%ebp)
ef: 83 45 0c 01 addl $0x1,0xc(%ebp)
while(*p && *p == *q)
f3: 8b 45 08 mov 0x8(%ebp),%eax
f6: 0f b6 00 movzbl (%eax),%eax
f9: 84 c0 test %al,%al
fb: 74 10 je 10d <strcmp+0x27>
fd: 8b 45 08 mov 0x8(%ebp),%eax
100: 0f b6 10 movzbl (%eax),%edx
103: 8b 45 0c mov 0xc(%ebp),%eax
106: 0f b6 00 movzbl (%eax),%eax
109: 38 c2 cmp %al,%dl
10b: 74 de je eb <strcmp+0x5>
return (uchar)*p - (uchar)*q;
10d: 8b 45 08 mov 0x8(%ebp),%eax
110: 0f b6 00 movzbl (%eax),%eax
113: 0f b6 d0 movzbl %al,%edx
116: 8b 45 0c mov 0xc(%ebp),%eax
119: 0f b6 00 movzbl (%eax),%eax
11c: 0f b6 c0 movzbl %al,%eax
11f: 29 c2 sub %eax,%edx
121: 89 d0 mov %edx,%eax
}
123: 5d pop %ebp
124: c3 ret
00000125 <strlen>:
uint
strlen(char *s)
{
125: 55 push %ebp
126: 89 e5 mov %esp,%ebp
128: 83 ec 10 sub $0x10,%esp
int n;
for(n = 0; s[n]; n++)
12b: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
132: eb 04 jmp 138 <strlen+0x13>
134: 83 45 fc 01 addl $0x1,-0x4(%ebp)
138: 8b 55 fc mov -0x4(%ebp),%edx
13b: 8b 45 08 mov 0x8(%ebp),%eax
13e: 01 d0 add %edx,%eax
140: 0f b6 00 movzbl (%eax),%eax
143: 84 c0 test %al,%al
145: 75 ed jne 134 <strlen+0xf>
;
return n;
147: 8b 45 fc mov -0x4(%ebp),%eax
}
14a: c9 leave
14b: c3 ret
0000014c <memset>:
void*
memset(void *dst, int c, uint n)
{
14c: 55 push %ebp
14d: 89 e5 mov %esp,%ebp
stosb(dst, c, n);
14f: 8b 45 10 mov 0x10(%ebp),%eax
152: 50 push %eax
153: ff 75 0c pushl 0xc(%ebp)
156: ff 75 08 pushl 0x8(%ebp)
159: e8 32 ff ff ff call 90 <stosb>
15e: 83 c4 0c add $0xc,%esp
return dst;
161: 8b 45 08 mov 0x8(%ebp),%eax
}
164: c9 leave
165: c3 ret
00000166 <strchr>:
char*
strchr(const char *s, char c)
{
166: 55 push %ebp
167: 89 e5 mov %esp,%ebp
169: 83 ec 04 sub $0x4,%esp
16c: 8b 45 0c mov 0xc(%ebp),%eax
16f: 88 45 fc mov %al,-0x4(%ebp)
for(; *s; s++)
172: eb 14 jmp 188 <strchr+0x22>
if(*s == c)
174: 8b 45 08 mov 0x8(%ebp),%eax
177: 0f b6 00 movzbl (%eax),%eax
17a: 38 45 fc cmp %al,-0x4(%ebp)
17d: 75 05 jne 184 <strchr+0x1e>
return (char*)s;
17f: 8b 45 08 mov 0x8(%ebp),%eax
182: eb 13 jmp 197 <strchr+0x31>
for(; *s; s++)
184: 83 45 08 01 addl $0x1,0x8(%ebp)
188: 8b 45 08 mov 0x8(%ebp),%eax
18b: 0f b6 00 movzbl (%eax),%eax
18e: 84 c0 test %al,%al
190: 75 e2 jne 174 <strchr+0xe>
return 0;
192: b8 00 00 00 00 mov $0x0,%eax
}
197: c9 leave
198: c3 ret
00000199 <gets>:
char*
gets(char *buf, int max)
{
199: 55 push %ebp
19a: 89 e5 mov %esp,%ebp
19c: 83 ec 18 sub $0x18,%esp
int i, cc;
char c;
for(i=0; i+1 < max; ){
19f: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
1a6: eb 42 jmp 1ea <gets+0x51>
cc = read(0, &c, 1);
1a8: 83 ec 04 sub $0x4,%esp
1ab: 6a 01 push $0x1
1ad: 8d 45 ef lea -0x11(%ebp),%eax
1b0: 50 push %eax
1b1: 6a 00 push $0x0
1b3: e8 47 01 00 00 call 2ff <read>
1b8: 83 c4 10 add $0x10,%esp
1bb: 89 45 f0 mov %eax,-0x10(%ebp)
if(cc < 1)
1be: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
1c2: 7e 33 jle 1f7 <gets+0x5e>
break;
buf[i++] = c;
1c4: 8b 45 f4 mov -0xc(%ebp),%eax
1c7: 8d 50 01 lea 0x1(%eax),%edx
1ca: 89 55 f4 mov %edx,-0xc(%ebp)
1cd: 89 c2 mov %eax,%edx
1cf: 8b 45 08 mov 0x8(%ebp),%eax
1d2: 01 c2 add %eax,%edx
1d4: 0f b6 45 ef movzbl -0x11(%ebp),%eax
1d8: 88 02 mov %al,(%edx)
if(c == '\n' || c == '\r')
1da: 0f b6 45 ef movzbl -0x11(%ebp),%eax
1de: 3c 0a cmp $0xa,%al
1e0: 74 16 je 1f8 <gets+0x5f>
1e2: 0f b6 45 ef movzbl -0x11(%ebp),%eax
1e6: 3c 0d cmp $0xd,%al
1e8: 74 0e je 1f8 <gets+0x5f>
for(i=0; i+1 < max; ){
1ea: 8b 45 f4 mov -0xc(%ebp),%eax
1ed: 83 c0 01 add $0x1,%eax
1f0: 39 45 0c cmp %eax,0xc(%ebp)
1f3: 7f b3 jg 1a8 <gets+0xf>
1f5: eb 01 jmp 1f8 <gets+0x5f>
break;
1f7: 90 nop
break;
}
buf[i] = '\0';
1f8: 8b 55 f4 mov -0xc(%ebp),%edx
1fb: 8b 45 08 mov 0x8(%ebp),%eax
1fe: 01 d0 add %edx,%eax
200: c6 00 00 movb $0x0,(%eax)
return buf;
203: 8b 45 08 mov 0x8(%ebp),%eax
}
206: c9 leave
207: c3 ret
00000208 <stat>:
int
stat(char *n, struct stat *st)
{
208: 55 push %ebp
209: 89 e5 mov %esp,%ebp
20b: 83 ec 18 sub $0x18,%esp
int fd;
int r;
fd = open(n, O_RDONLY);
20e: 83 ec 08 sub $0x8,%esp
211: 6a 00 push $0x0
213: ff 75 08 pushl 0x8(%ebp)
216: e8 0c 01 00 00 call 327 <open>
21b: 83 c4 10 add $0x10,%esp
21e: 89 45 f4 mov %eax,-0xc(%ebp)
if(fd < 0)
221: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
225: 79 07 jns 22e <stat+0x26>
return -1;
227: b8 ff ff ff ff mov $0xffffffff,%eax
22c: eb 25 jmp 253 <stat+0x4b>
r = fstat(fd, st);
22e: 83 ec 08 sub $0x8,%esp
231: ff 75 0c pushl 0xc(%ebp)
234: ff 75 f4 pushl -0xc(%ebp)
237: e8 03 01 00 00 call 33f <fstat>
23c: 83 c4 10 add $0x10,%esp
23f: 89 45 f0 mov %eax,-0x10(%ebp)
close(fd);
242: 83 ec 0c sub $0xc,%esp
245: ff 75 f4 pushl -0xc(%ebp)
248: e8 c2 00 00 00 call 30f <close>
24d: 83 c4 10 add $0x10,%esp
return r;
250: 8b 45 f0 mov -0x10(%ebp),%eax
}
253: c9 leave
254: c3 ret
00000255 <atoi>:
int
atoi(const char *s)
{
255: 55 push %ebp
256: 89 e5 mov %esp,%ebp
258: 83 ec 10 sub $0x10,%esp
int n;
n = 0;
25b: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
while('0' <= *s && *s <= '9')
262: eb 25 jmp 289 <atoi+0x34>
n = n*10 + *s++ - '0';
264: 8b 55 fc mov -0x4(%ebp),%edx
267: 89 d0 mov %edx,%eax
269: c1 e0 02 shl $0x2,%eax
26c: 01 d0 add %edx,%eax
26e: 01 c0 add %eax,%eax
270: 89 c1 mov %eax,%ecx
272: 8b 45 08 mov 0x8(%ebp),%eax
275: 8d 50 01 lea 0x1(%eax),%edx
278: 89 55 08 mov %edx,0x8(%ebp)
27b: 0f b6 00 movzbl (%eax),%eax
27e: 0f be c0 movsbl %al,%eax
281: 01 c8 add %ecx,%eax
283: 83 e8 30 sub $0x30,%eax
286: 89 45 fc mov %eax,-0x4(%ebp)
while('0' <= *s && *s <= '9')
289: 8b 45 08 mov 0x8(%ebp),%eax
28c: 0f b6 00 movzbl (%eax),%eax
28f: 3c 2f cmp $0x2f,%al
291: 7e 0a jle 29d <atoi+0x48>
293: 8b 45 08 mov 0x8(%ebp),%eax
296: 0f b6 00 movzbl (%eax),%eax
299: 3c 39 cmp $0x39,%al
29b: 7e c7 jle 264 <atoi+0xf>
return n;
29d: 8b 45 fc mov -0x4(%ebp),%eax
}
2a0: c9 leave
2a1: c3 ret
000002a2 <memmove>:
void*
memmove(void *vdst, void *vsrc, int n)
{
2a2: 55 push %ebp
2a3: 89 e5 mov %esp,%ebp
2a5: 83 ec 10 sub $0x10,%esp
char *dst, *src;
dst = vdst;
2a8: 8b 45 08 mov 0x8(%ebp),%eax
2ab: 89 45 fc mov %eax,-0x4(%ebp)
src = vsrc;
2ae: 8b 45 0c mov 0xc(%ebp),%eax
2b1: 89 45 f8 mov %eax,-0x8(%ebp)
while(n-- > 0)
2b4: eb 17 jmp 2cd <memmove+0x2b>
*dst++ = *src++;
2b6: 8b 55 f8 mov -0x8(%ebp),%edx
2b9: 8d 42 01 lea 0x1(%edx),%eax
2bc: 89 45 f8 mov %eax,-0x8(%ebp)
2bf: 8b 45 fc mov -0x4(%ebp),%eax
2c2: 8d 48 01 lea 0x1(%eax),%ecx
2c5: 89 4d fc mov %ecx,-0x4(%ebp)
2c8: 0f b6 12 movzbl (%edx),%edx
2cb: 88 10 mov %dl,(%eax)
while(n-- > 0)
2cd: 8b 45 10 mov 0x10(%ebp),%eax
2d0: 8d 50 ff lea -0x1(%eax),%edx
2d3: 89 55 10 mov %edx,0x10(%ebp)
2d6: 85 c0 test %eax,%eax
2d8: 7f dc jg 2b6 <memmove+0x14>
return vdst;
2da: 8b 45 08 mov 0x8(%ebp),%eax
}
2dd: c9 leave
2de: c3 ret
000002df <fork>:
2df: b8 01 00 00 00 mov $0x1,%eax
2e4: cd 40 int $0x40
2e6: c3 ret
000002e7 <exit>:
2e7: b8 02 00 00 00 mov $0x2,%eax
2ec: cd 40 int $0x40
2ee: c3 ret
000002ef <wait>:
2ef: b8 03 00 00 00 mov $0x3,%eax
2f4: cd 40 int $0x40
2f6: c3 ret
000002f7 <pipe>:
2f7: b8 04 00 00 00 mov $0x4,%eax
2fc: cd 40 int $0x40
2fe: c3 ret
000002ff <read>:
2ff: b8 05 00 00 00 mov $0x5,%eax
304: cd 40 int $0x40
306: c3 ret
00000307 <write>:
307: b8 10 00 00 00 mov $0x10,%eax
30c: cd 40 int $0x40
30e: c3 ret
0000030f <close>:
30f: b8 15 00 00 00 mov $0x15,%eax
314: cd 40 int $0x40
316: c3 ret
00000317 <kill>:
317: b8 06 00 00 00 mov $0x6,%eax
31c: cd 40 int $0x40
31e: c3 ret
0000031f <exec>:
31f: b8 07 00 00 00 mov $0x7,%eax
324: cd 40 int $0x40
326: c3 ret
00000327 <open>:
327: b8 0f 00 00 00 mov $0xf,%eax
32c: cd 40 int $0x40
32e: c3 ret
0000032f <mknod>:
32f: b8 11 00 00 00 mov $0x11,%eax
334: cd 40 int $0x40
336: c3 ret
00000337 <unlink>:
337: b8 12 00 00 00 mov $0x12,%eax
33c: cd 40 int $0x40
33e: c3 ret
0000033f <fstat>:
33f: b8 08 00 00 00 mov $0x8,%eax
344: cd 40 int $0x40
346: c3 ret
00000347 <link>:
347: b8 13 00 00 00 mov $0x13,%eax
34c: cd 40 int $0x40
34e: c3 ret
0000034f <mkdir>:
34f: b8 14 00 00 00 mov $0x14,%eax
354: cd 40 int $0x40
356: c3 ret
00000357 <chdir>:
357: b8 09 00 00 00 mov $0x9,%eax
35c: cd 40 int $0x40
35e: c3 ret
0000035f <dup>:
35f: b8 0a 00 00 00 mov $0xa,%eax
364: cd 40 int $0x40
366: c3 ret
00000367 <getpid>:
367: b8 0b 00 00 00 mov $0xb,%eax
36c: cd 40 int $0x40
36e: c3 ret
0000036f <sbrk>:
36f: b8 0c 00 00 00 mov $0xc,%eax
374: cd 40 int $0x40
376: c3 ret
00000377 <sleep>:
377: b8 0d 00 00 00 mov $0xd,%eax
37c: cd 40 int $0x40
37e: c3 ret
0000037f <uptime>:
37f: b8 0e 00 00 00 mov $0xe,%eax
384: cd 40 int $0x40
386: c3 ret
00000387 <putc>:
#include "stat.h"
#include "user.h"
static void
putc(int fd, char c)
{
387: 55 push %ebp
388: 89 e5 mov %esp,%ebp
38a: 83 ec 18 sub $0x18,%esp
38d: 8b 45 0c mov 0xc(%ebp),%eax
390: 88 45 f4 mov %al,-0xc(%ebp)
write(fd, &c, 1);
393: 83 ec 04 sub $0x4,%esp
396: 6a 01 push $0x1
398: 8d 45 f4 lea -0xc(%ebp),%eax
39b: 50 push %eax
39c: ff 75 08 pushl 0x8(%ebp)
39f: e8 63 ff ff ff call 307 <write>
3a4: 83 c4 10 add $0x10,%esp
}
3a7: 90 nop
3a8: c9 leave
3a9: c3 ret
000003aa <printint>:
static void
printint(int fd, int xx, int base, int sgn)
{
3aa: 55 push %ebp
3ab: 89 e5 mov %esp,%ebp
3ad: 83 ec 28 sub $0x28,%esp
static char digits[] = "0123456789ABCDEF";
char buf[16];
int i, neg;
uint x;
neg = 0;
3b0: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
if(sgn && xx < 0){
3b7: 83 7d 14 00 cmpl $0x0,0x14(%ebp)
3bb: 74 17 je 3d4 <printint+0x2a>
3bd: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
3c1: 79 11 jns 3d4 <printint+0x2a>
neg = 1;
3c3: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp)
x = -xx;
3ca: 8b 45 0c mov 0xc(%ebp),%eax
3cd: f7 d8 neg %eax
3cf: 89 45 ec mov %eax,-0x14(%ebp)
3d2: eb 06 jmp 3da <printint+0x30>
} else {
x = xx;
3d4: 8b 45 0c mov 0xc(%ebp),%eax
3d7: 89 45 ec mov %eax,-0x14(%ebp)
}
i = 0;
3da: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
do{
buf[i++] = digits[x % base];
3e1: 8b 4d 10 mov 0x10(%ebp),%ecx
3e4: 8b 45 ec mov -0x14(%ebp),%eax
3e7: ba 00 00 00 00 mov $0x0,%edx
3ec: f7 f1 div %ecx
3ee: 89 d1 mov %edx,%ecx
3f0: 8b 45 f4 mov -0xc(%ebp),%eax
3f3: 8d 50 01 lea 0x1(%eax),%edx
3f6: 89 55 f4 mov %edx,-0xc(%ebp)
3f9: 0f b6 91 8c 0a 00 00 movzbl 0xa8c(%ecx),%edx
400: 88 54 05 dc mov %dl,-0x24(%ebp,%eax,1)
}while((x /= base) != 0);
404: 8b 4d 10 mov 0x10(%ebp),%ecx
407: 8b 45 ec mov -0x14(%ebp),%eax
40a: ba 00 00 00 00 mov $0x0,%edx
40f: f7 f1 div %ecx
411: 89 45 ec mov %eax,-0x14(%ebp)
414: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
418: 75 c7 jne 3e1 <printint+0x37>
if(neg)
41a: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
41e: 74 2d je 44d <printint+0xa3>
buf[i++] = '-';
420: 8b 45 f4 mov -0xc(%ebp),%eax
423: 8d 50 01 lea 0x1(%eax),%edx
426: 89 55 f4 mov %edx,-0xc(%ebp)
429: c6 44 05 dc 2d movb $0x2d,-0x24(%ebp,%eax,1)
while(--i >= 0)
42e: eb 1d jmp 44d <printint+0xa3>
putc(fd, buf[i]);
430: 8d 55 dc lea -0x24(%ebp),%edx
433: 8b 45 f4 mov -0xc(%ebp),%eax
436: 01 d0 add %edx,%eax
438: 0f b6 00 movzbl (%eax),%eax
43b: 0f be c0 movsbl %al,%eax
43e: 83 ec 08 sub $0x8,%esp
441: 50 push %eax
442: ff 75 08 pushl 0x8(%ebp)
445: e8 3d ff ff ff call 387 <putc>
44a: 83 c4 10 add $0x10,%esp
while(--i >= 0)
44d: 83 6d f4 01 subl $0x1,-0xc(%ebp)
451: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
455: 79 d9 jns 430 <printint+0x86>
}
457: 90 nop
458: c9 leave
459: c3 ret
0000045a <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
45a: 55 push %ebp
45b: 89 e5 mov %esp,%ebp
45d: 83 ec 28 sub $0x28,%esp
char *s;
int c, i, state;
uint *ap;
state = 0;
460: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
ap = (uint*)(void*)&fmt + 1;
467: 8d 45 0c lea 0xc(%ebp),%eax
46a: 83 c0 04 add $0x4,%eax
46d: 89 45 e8 mov %eax,-0x18(%ebp)
for(i = 0; fmt[i]; i++){
470: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
477: e9 59 01 00 00 jmp 5d5 <printf+0x17b>
c = fmt[i] & 0xff;
47c: 8b 55 0c mov 0xc(%ebp),%edx
47f: 8b 45 f0 mov -0x10(%ebp),%eax
482: 01 d0 add %edx,%eax
484: 0f b6 00 movzbl (%eax),%eax
487: 0f be c0 movsbl %al,%eax
48a: 25 ff 00 00 00 and $0xff,%eax
48f: 89 45 e4 mov %eax,-0x1c(%ebp)
if(state == 0){
492: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
496: 75 2c jne 4c4 <printf+0x6a>
if(c == '%'){
498: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
49c: 75 0c jne 4aa <printf+0x50>
state = '%';
49e: c7 45 ec 25 00 00 00 movl $0x25,-0x14(%ebp)
4a5: e9 27 01 00 00 jmp 5d1 <printf+0x177>
} else {
putc(fd, c);
4aa: 8b 45 e4 mov -0x1c(%ebp),%eax
4ad: 0f be c0 movsbl %al,%eax
4b0: 83 ec 08 sub $0x8,%esp
4b3: 50 push %eax
4b4: ff 75 08 pushl 0x8(%ebp)
4b7: e8 cb fe ff ff call 387 <putc>
4bc: 83 c4 10 add $0x10,%esp
4bf: e9 0d 01 00 00 jmp 5d1 <printf+0x177>
}
} else if(state == '%'){
4c4: 83 7d ec 25 cmpl $0x25,-0x14(%ebp)
4c8: 0f 85 03 01 00 00 jne 5d1 <printf+0x177>
if(c == 'd'){
4ce: 83 7d e4 64 cmpl $0x64,-0x1c(%ebp)
4d2: 75 1e jne 4f2 <printf+0x98>
printint(fd, *ap, 10, 1);
4d4: 8b 45 e8 mov -0x18(%ebp),%eax
4d7: 8b 00 mov (%eax),%eax
4d9: 6a 01 push $0x1
4db: 6a 0a push $0xa
4dd: 50 push %eax
4de: ff 75 08 pushl 0x8(%ebp)
4e1: e8 c4 fe ff ff call 3aa <printint>
4e6: 83 c4 10 add $0x10,%esp
ap++;
4e9: 83 45 e8 04 addl $0x4,-0x18(%ebp)
4ed: e9 d8 00 00 00 jmp 5ca <printf+0x170>
} else if(c == 'x' || c == 'p'){
4f2: 83 7d e4 78 cmpl $0x78,-0x1c(%ebp)
4f6: 74 06 je 4fe <printf+0xa4>
4f8: 83 7d e4 70 cmpl $0x70,-0x1c(%ebp)
4fc: 75 1e jne 51c <printf+0xc2>
printint(fd, *ap, 16, 0);
4fe: 8b 45 e8 mov -0x18(%ebp),%eax
501: 8b 00 mov (%eax),%eax
503: 6a 00 push $0x0
505: 6a 10 push $0x10
507: 50 push %eax
508: ff 75 08 pushl 0x8(%ebp)
50b: e8 9a fe ff ff call 3aa <printint>
510: 83 c4 10 add $0x10,%esp
ap++;
513: 83 45 e8 04 addl $0x4,-0x18(%ebp)
517: e9 ae 00 00 00 jmp 5ca <printf+0x170>
} else if(c == 's'){
51c: 83 7d e4 73 cmpl $0x73,-0x1c(%ebp)
520: 75 43 jne 565 <printf+0x10b>
s = (char*)*ap;
522: 8b 45 e8 mov -0x18(%ebp),%eax
525: 8b 00 mov (%eax),%eax
527: 89 45 f4 mov %eax,-0xc(%ebp)
ap++;
52a: 83 45 e8 04 addl $0x4,-0x18(%ebp)
if(s == 0)
52e: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
532: 75 25 jne 559 <printf+0xff>
s = "(null)";
534: c7 45 f4 3d 08 00 00 movl $0x83d,-0xc(%ebp)
while(*s != 0){
53b: eb 1c jmp 559 <printf+0xff>
putc(fd, *s);
53d: 8b 45 f4 mov -0xc(%ebp),%eax
540: 0f b6 00 movzbl (%eax),%eax
543: 0f be c0 movsbl %al,%eax
546: 83 ec 08 sub $0x8,%esp
549: 50 push %eax
54a: ff 75 08 pushl 0x8(%ebp)
54d: e8 35 fe ff ff call 387 <putc>
552: 83 c4 10 add $0x10,%esp
s++;
555: 83 45 f4 01 addl $0x1,-0xc(%ebp)
while(*s != 0){
559: 8b 45 f4 mov -0xc(%ebp),%eax
55c: 0f b6 00 movzbl (%eax),%eax
55f: 84 c0 test %al,%al
561: 75 da jne 53d <printf+0xe3>
563: eb 65 jmp 5ca <printf+0x170>
}
} else if(c == 'c'){
565: 83 7d e4 63 cmpl $0x63,-0x1c(%ebp)
569: 75 1d jne 588 <printf+0x12e>
putc(fd, *ap);
56b: 8b 45 e8 mov -0x18(%ebp),%eax
56e: 8b 00 mov (%eax),%eax
570: 0f be c0 movsbl %al,%eax
573: 83 ec 08 sub $0x8,%esp
576: 50 push %eax
577: ff 75 08 pushl 0x8(%ebp)
57a: e8 08 fe ff ff call 387 <putc>
57f: 83 c4 10 add $0x10,%esp
ap++;
582: 83 45 e8 04 addl $0x4,-0x18(%ebp)
586: eb 42 jmp 5ca <printf+0x170>
} else if(c == '%'){
588: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
58c: 75 17 jne 5a5 <printf+0x14b>
putc(fd, c);
58e: 8b 45 e4 mov -0x1c(%ebp),%eax
591: 0f be c0 movsbl %al,%eax
594: 83 ec 08 sub $0x8,%esp
597: 50 push %eax
598: ff 75 08 pushl 0x8(%ebp)
59b: e8 e7 fd ff ff call 387 <putc>
5a0: 83 c4 10 add $0x10,%esp
5a3: eb 25 jmp 5ca <printf+0x170>
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
5a5: 83 ec 08 sub $0x8,%esp
5a8: 6a 25 push $0x25
5aa: ff 75 08 pushl 0x8(%ebp)
5ad: e8 d5 fd ff ff call 387 <putc>
5b2: 83 c4 10 add $0x10,%esp
putc(fd, c);
5b5: 8b 45 e4 mov -0x1c(%ebp),%eax
5b8: 0f be c0 movsbl %al,%eax
5bb: 83 ec 08 sub $0x8,%esp
5be: 50 push %eax
5bf: ff 75 08 pushl 0x8(%ebp)
5c2: e8 c0 fd ff ff call 387 <putc>
5c7: 83 c4 10 add $0x10,%esp
}
state = 0;
5ca: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
for(i = 0; fmt[i]; i++){
5d1: 83 45 f0 01 addl $0x1,-0x10(%ebp)
5d5: 8b 55 0c mov 0xc(%ebp),%edx
5d8: 8b 45 f0 mov -0x10(%ebp),%eax
5db: 01 d0 add %edx,%eax
5dd: 0f b6 00 movzbl (%eax),%eax
5e0: 84 c0 test %al,%al
5e2: 0f 85 94 fe ff ff jne 47c <printf+0x22>
}
}
}
5e8: 90 nop
5e9: c9 leave
5ea: c3 ret
000005eb <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
5eb: 55 push %ebp
5ec: 89 e5 mov %esp,%ebp
5ee: 83 ec 10 sub $0x10,%esp
Header *bp, *p;
bp = (Header*)ap - 1;
5f1: 8b 45 08 mov 0x8(%ebp),%eax
5f4: 83 e8 08 sub $0x8,%eax
5f7: 89 45 f8 mov %eax,-0x8(%ebp)
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
5fa: a1 a8 0a 00 00 mov 0xaa8,%eax
5ff: 89 45 fc mov %eax,-0x4(%ebp)
602: eb 24 jmp 628 <free+0x3d>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
604: 8b 45 fc mov -0x4(%ebp),%eax
607: 8b 00 mov (%eax),%eax
609: 39 45 fc cmp %eax,-0x4(%ebp)
60c: 72 12 jb 620 <free+0x35>
60e: 8b 45 f8 mov -0x8(%ebp),%eax
611: 3b 45 fc cmp -0x4(%ebp),%eax
614: 77 24 ja 63a <free+0x4f>
616: 8b 45 fc mov -0x4(%ebp),%eax
619: 8b 00 mov (%eax),%eax
61b: 39 45 f8 cmp %eax,-0x8(%ebp)
61e: 72 1a jb 63a <free+0x4f>
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
620: 8b 45 fc mov -0x4(%ebp),%eax
623: 8b 00 mov (%eax),%eax
625: 89 45 fc mov %eax,-0x4(%ebp)
628: 8b 45 f8 mov -0x8(%ebp),%eax
62b: 3b 45 fc cmp -0x4(%ebp),%eax
62e: 76 d4 jbe 604 <free+0x19>
630: 8b 45 fc mov -0x4(%ebp),%eax
633: 8b 00 mov (%eax),%eax
635: 39 45 f8 cmp %eax,-0x8(%ebp)
638: 73 ca jae 604 <free+0x19>
break;
if(bp + bp->s.size == p->s.ptr){
63a: 8b 45 f8 mov -0x8(%ebp),%eax
63d: 8b 40 04 mov 0x4(%eax),%eax
640: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
647: 8b 45 f8 mov -0x8(%ebp),%eax
64a: 01 c2 add %eax,%edx
64c: 8b 45 fc mov -0x4(%ebp),%eax
64f: 8b 00 mov (%eax),%eax
651: 39 c2 cmp %eax,%edx
653: 75 24 jne 679 <free+0x8e>
bp->s.size += p->s.ptr->s.size;
655: 8b 45 f8 mov -0x8(%ebp),%eax
658: 8b 50 04 mov 0x4(%eax),%edx
65b: 8b 45 fc mov -0x4(%ebp),%eax
65e: 8b 00 mov (%eax),%eax
660: 8b 40 04 mov 0x4(%eax),%eax
663: 01 c2 add %eax,%edx
665: 8b 45 f8 mov -0x8(%ebp),%eax
668: 89 50 04 mov %edx,0x4(%eax)
bp->s.ptr = p->s.ptr->s.ptr;
66b: 8b 45 fc mov -0x4(%ebp),%eax
66e: 8b 00 mov (%eax),%eax
670: 8b 10 mov (%eax),%edx
672: 8b 45 f8 mov -0x8(%ebp),%eax
675: 89 10 mov %edx,(%eax)
677: eb 0a jmp 683 <free+0x98>
} else
bp->s.ptr = p->s.ptr;
679: 8b 45 fc mov -0x4(%ebp),%eax
67c: 8b 10 mov (%eax),%edx
67e: 8b 45 f8 mov -0x8(%ebp),%eax
681: 89 10 mov %edx,(%eax)
if(p + p->s.size == bp){
683: 8b 45 fc mov -0x4(%ebp),%eax
686: 8b 40 04 mov 0x4(%eax),%eax
689: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
690: 8b 45 fc mov -0x4(%ebp),%eax
693: 01 d0 add %edx,%eax
695: 39 45 f8 cmp %eax,-0x8(%ebp)
698: 75 20 jne 6ba <free+0xcf>
p->s.size += bp->s.size;
69a: 8b 45 fc mov -0x4(%ebp),%eax
69d: 8b 50 04 mov 0x4(%eax),%edx
6a0: 8b 45 f8 mov -0x8(%ebp),%eax
6a3: 8b 40 04 mov 0x4(%eax),%eax
6a6: 01 c2 add %eax,%edx
6a8: 8b 45 fc mov -0x4(%ebp),%eax
6ab: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
6ae: 8b 45 f8 mov -0x8(%ebp),%eax
6b1: 8b 10 mov (%eax),%edx
6b3: 8b 45 fc mov -0x4(%ebp),%eax
6b6: 89 10 mov %edx,(%eax)
6b8: eb 08 jmp 6c2 <free+0xd7>
} else
p->s.ptr = bp;
6ba: 8b 45 fc mov -0x4(%ebp),%eax
6bd: 8b 55 f8 mov -0x8(%ebp),%edx
6c0: 89 10 mov %edx,(%eax)
freep = p;
6c2: 8b 45 fc mov -0x4(%ebp),%eax
6c5: a3 a8 0a 00 00 mov %eax,0xaa8
}
6ca: 90 nop
6cb: c9 leave
6cc: c3 ret
000006cd <morecore>:
static Header*
morecore(uint nu)
{
6cd: 55 push %ebp
6ce: 89 e5 mov %esp,%ebp
6d0: 83 ec 18 sub $0x18,%esp
char *p;
Header *hp;
if(nu < 4096)
6d3: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp)
6da: 77 07 ja 6e3 <morecore+0x16>
nu = 4096;
6dc: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp)
p = sbrk(nu * sizeof(Header));
6e3: 8b 45 08 mov 0x8(%ebp),%eax
6e6: c1 e0 03 shl $0x3,%eax
6e9: 83 ec 0c sub $0xc,%esp
6ec: 50 push %eax
6ed: e8 7d fc ff ff call 36f <sbrk>
6f2: 83 c4 10 add $0x10,%esp
6f5: 89 45 f4 mov %eax,-0xc(%ebp)
if(p == (char*)-1)
6f8: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp)
6fc: 75 07 jne 705 <morecore+0x38>
return 0;
6fe: b8 00 00 00 00 mov $0x0,%eax
703: eb 26 jmp 72b <morecore+0x5e>
hp = (Header*)p;
705: 8b 45 f4 mov -0xc(%ebp),%eax
708: 89 45 f0 mov %eax,-0x10(%ebp)
hp->s.size = nu;
70b: 8b 45 f0 mov -0x10(%ebp),%eax
70e: 8b 55 08 mov 0x8(%ebp),%edx
711: 89 50 04 mov %edx,0x4(%eax)
free((void*)(hp + 1));
714: 8b 45 f0 mov -0x10(%ebp),%eax
717: 83 c0 08 add $0x8,%eax
71a: 83 ec 0c sub $0xc,%esp
71d: 50 push %eax
71e: e8 c8 fe ff ff call 5eb <free>
723: 83 c4 10 add $0x10,%esp
return freep;
726: a1 a8 0a 00 00 mov 0xaa8,%eax
}
72b: c9 leave
72c: c3 ret
0000072d <malloc>:
void*
malloc(uint nbytes)
{
72d: 55 push %ebp
72e: 89 e5 mov %esp,%ebp
730: 83 ec 18 sub $0x18,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
733: 8b 45 08 mov 0x8(%ebp),%eax
736: 83 c0 07 add $0x7,%eax
739: c1 e8 03 shr $0x3,%eax
73c: 83 c0 01 add $0x1,%eax
73f: 89 45 ec mov %eax,-0x14(%ebp)
if((prevp = freep) == 0){
742: a1 a8 0a 00 00 mov 0xaa8,%eax
747: 89 45 f0 mov %eax,-0x10(%ebp)
74a: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
74e: 75 23 jne 773 <malloc+0x46>
base.s.ptr = freep = prevp = &base;
750: c7 45 f0 a0 0a 00 00 movl $0xaa0,-0x10(%ebp)
757: 8b 45 f0 mov -0x10(%ebp),%eax
75a: a3 a8 0a 00 00 mov %eax,0xaa8
75f: a1 a8 0a 00 00 mov 0xaa8,%eax
764: a3 a0 0a 00 00 mov %eax,0xaa0
base.s.size = 0;
769: c7 05 a4 0a 00 00 00 movl $0x0,0xaa4
770: 00 00 00
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
773: 8b 45 f0 mov -0x10(%ebp),%eax
776: 8b 00 mov (%eax),%eax
778: 89 45 f4 mov %eax,-0xc(%ebp)
if(p->s.size >= nunits){
77b: 8b 45 f4 mov -0xc(%ebp),%eax
77e: 8b 40 04 mov 0x4(%eax),%eax
781: 39 45 ec cmp %eax,-0x14(%ebp)
784: 77 4d ja 7d3 <malloc+0xa6>
if(p->s.size == nunits)
786: 8b 45 f4 mov -0xc(%ebp),%eax
789: 8b 40 04 mov 0x4(%eax),%eax
78c: 39 45 ec cmp %eax,-0x14(%ebp)
78f: 75 0c jne 79d <malloc+0x70>
prevp->s.ptr = p->s.ptr;
791: 8b 45 f4 mov -0xc(%ebp),%eax
794: 8b 10 mov (%eax),%edx
796: 8b 45 f0 mov -0x10(%ebp),%eax
799: 89 10 mov %edx,(%eax)
79b: eb 26 jmp 7c3 <malloc+0x96>
else {
p->s.size -= nunits;
79d: 8b 45 f4 mov -0xc(%ebp),%eax
7a0: 8b 40 04 mov 0x4(%eax),%eax
7a3: 2b 45 ec sub -0x14(%ebp),%eax
7a6: 89 c2 mov %eax,%edx
7a8: 8b 45 f4 mov -0xc(%ebp),%eax
7ab: 89 50 04 mov %edx,0x4(%eax)
p += p->s.size;
7ae: 8b 45 f4 mov -0xc(%ebp),%eax
7b1: 8b 40 04 mov 0x4(%eax),%eax
7b4: c1 e0 03 shl $0x3,%eax
7b7: 01 45 f4 add %eax,-0xc(%ebp)
p->s.size = nunits;
7ba: 8b 45 f4 mov -0xc(%ebp),%eax
7bd: 8b 55 ec mov -0x14(%ebp),%edx
7c0: 89 50 04 mov %edx,0x4(%eax)
}
freep = prevp;
7c3: 8b 45 f0 mov -0x10(%ebp),%eax
7c6: a3 a8 0a 00 00 mov %eax,0xaa8
return (void*)(p + 1);
7cb: 8b 45 f4 mov -0xc(%ebp),%eax
7ce: 83 c0 08 add $0x8,%eax
7d1: eb 3b jmp 80e <malloc+0xe1>
}
if(p == freep)
7d3: a1 a8 0a 00 00 mov 0xaa8,%eax
7d8: 39 45 f4 cmp %eax,-0xc(%ebp)
7db: 75 1e jne 7fb <malloc+0xce>
if((p = morecore(nunits)) == 0)
7dd: 83 ec 0c sub $0xc,%esp
7e0: ff 75 ec pushl -0x14(%ebp)
7e3: e8 e5 fe ff ff call 6cd <morecore>
7e8: 83 c4 10 add $0x10,%esp
7eb: 89 45 f4 mov %eax,-0xc(%ebp)
7ee: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
7f2: 75 07 jne 7fb <malloc+0xce>
return 0;
7f4: b8 00 00 00 00 mov $0x0,%eax
7f9: eb 13 jmp 80e <malloc+0xe1>
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
7fb: 8b 45 f4 mov -0xc(%ebp),%eax
7fe: 89 45 f0 mov %eax,-0x10(%ebp)
801: 8b 45 f4 mov -0xc(%ebp),%eax
804: 8b 00 mov (%eax),%eax
806: 89 45 f4 mov %eax,-0xc(%ebp)
if(p->s.size >= nunits){
809: e9 6d ff ff ff jmp 77b <malloc+0x4e>
}
}
80e: c9 leave
80f: c3 ret
| 35.857143 | 60 | 0.4174 | [
"Apache-2.0"
] | douglasbreyer/StrideXV6 | rm.asm | 39,911 | Assembly |
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r15
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0xa1f9, %rsi
lea addresses_WC_ht+0x1efd9, %rdi
xor $43189, %r15
mov $92, %rcx
rep movsq
nop
nop
nop
cmp $57321, %r15
lea addresses_WT_ht+0x10c39, %rdi
nop
nop
nop
cmp $27843, %rcx
movb $0x61, (%rdi)
nop
nop
add $16306, %r11
lea addresses_WC_ht+0x18cfd, %rbp
nop
xor %rcx, %rcx
mov (%rbp), %esi
nop
nop
nop
add %r15, %r15
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r15
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r14
push %rax
push %rbp
push %rcx
push %rdx
// Load
lea addresses_US+0x1d339, %rcx
nop
nop
nop
and $27426, %r14
mov (%rcx), %r11d
nop
nop
and %rbp, %rbp
// Faulty Load
lea addresses_PSE+0xa439, %r10
nop
nop
and %rax, %rax
vmovntdqa (%r10), %ymm6
vextracti128 $0, %ymm6, %xmm6
vpextrq $1, %xmm6, %rdx
lea oracles, %r10
and $0xff, %rdx
shlq $12, %rdx
mov (%r10,%rdx,1), %rdx
pop %rdx
pop %rcx
pop %rbp
pop %rax
pop %r14
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_PSE', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 6, 'NT': False, 'type': 'addresses_US', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'same': True, 'congruent': 0, 'NT': True, 'type': 'addresses_PSE', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_normal_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 4, 'same': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 10, 'NT': False, 'type': 'addresses_WT_ht', 'size': 1, 'AVXalign': False}}
{'src': {'same': False, 'congruent': 2, 'NT': False, 'type': 'addresses_WC_ht', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'}
{'44': 21829}
44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44
*/
| 49.181818 | 2,999 | 0.6603 | [
"MIT"
] | danielmgmi/medusa | Transynther/_processed/AVXALIGN/_ht_/i3-7100_9_0xca_notsx.log_21829_1142.asm | 4,869 | Assembly |
#import "ntplay-defs.asm"
.const RASTER_LINE = $33
.pc = $02 "Zero page variables" virtual
#import "ntplay-vars.asm"
.pc = $0801 "Basic Upstart"
:BasicUpstart(start)
.pc = $0810 "Code"
start: {
sei
cld
lda #<musicdata
ldx #>musicdata
jsr nt_newmusic
lda #0
jsr nt_playsong
loop:
!: lda $d011
bpl !-
!: lda $d011
bmi !-
lda #RASTER_LINE
!: cmp $d012
bne !-
inc $d020
jsr nt_music
dec $d020
jmp loop
}
#import "ntplay.asm"
.pc = * "Music data"
.define sb {
.var sb = songBookCreate()
.eval waveTableAdd(sb, List().add(
"wave1:",
"set $81 C-6",
"set $41 E-3",
"set $41",
"end",
"wave2:",
"set $21",
"del $08",
"vib $1B $10",
"wave3:",
"set $51",
"wave4:",
"set $41",
"end",
"wave5:",
"set $41 +0",
"set $41 +3",
"set $41 +7",
"set $41 +12",
"jmp wave5",
"wave6:",
"set $41 +0",
"set $41 +4",
"set $41 +7",
"set $41 +12",
"jmp wave6",
"wave7:",
"sli $1E00",
"wave8:",
"set $81 E-6",
"set $41",
"end",
"wave9:",
"set $81 E-6",
"set $41 A#3",
"set $41 E-3",
"set $81 D-6",
"set $81 A#5",
"set $41",
"end",
"wave10:",
"set $51",
"set $41",
"del $18",
"vib $1B $10",
"wave11:",
"sli $0040"
))
.eval pulseTableAdd(sb, List().add(
"pulse1:",
"set $08",
"pulse2:",
"set $08",
"set $08",
"pulse3:",
"set $01",
"loop1:",
"mod $60 32",
"mod $60 -33",
"jmp loop1",
"pulse4:",
"set $01",
"mod $08 $50",
"jmp loop1",
"pulse5:",
"set $80",
"loop2:",
"mod $18 -128",
"mod $18 127",
"jmp loop2"
))
.eval filterTableAdd(sb, List().add(
"filter1:",
"set 1 2 $60",
"loop:",
"mod $60 1",
"mod $60 -1",
"jmp loop"
))
// Commands
.eval commandAdd(sb, "bs+kick", $09BB, "wave1", "pulse2", 0)
.eval commandAdd(sb, "bs+hihat", $09BB, "wave8", "pulse3", 0)
.eval commandAdd(sb, "bs+snare", $09BB, "wave9", "pulse1", 0)
.eval commandAdd(sb, "sawtooth", $006C, "wave2", 0, "filter1")
.eval commandAdd(sb, "pulselead", $068C, "wave3", "pulse4", 0)
.eval commandAdd(sb, "pulse-min", $074B, "wave5", "pulse4", "filter1")
.eval commandAdd(sb, "pulse-maj", $074B, "wave6", "pulse4", "filter1")
.eval commandAdd(sb, "quietpuls", $044B, "wave4", "pulse5", 0)
.eval commandAdd(sb, "pulsl+vib", $068C, "wave10", "pulse4", 0)
.eval commandAdd(sb, "slide-fff", $0000, "wave7", 0, 0)
.eval commandAdd(sb, "slide-040", $0000, "wave11", 0, 0)
// Patterns
.eval patternAdd(sb, "01", List().add(
"--- 40"
))
.eval patternAdd(sb, "02", List().add(
"A-1 40 bs+kick",
"+++",
"+++",
"+++",
"G-1",
"+++",
"+++",
"+++",
"D-2",
"+++",
"+++",
"+++",
"A-1",
"+++",
"+++",
"+++"
))
.eval patternAdd(sb, "03", List().add(
"C-4 40 sawtooth",
"+++",
"+++",
"+++",
"B-3",
"+++",
"+++",
"A-3 20",
"G-3",
"C-4 40",
"+++",
"+++",
"+++",
"A-3",
"+++",
"+++",
"+++"
))
.eval patternAdd(sb, "04", List().add(
"E-4 10 pulselead",
"D-4",
"E-4",
"A-4 30",
"E-4",
"E-4",
"D-4 20",
"C-4",
"D-4 10",
"C-4",
"D-4",
"G-4 30",
"D-4",
"D-4",
"C-4 20",
"B-3",
"C-4 10",
"B-3",
"A-3",
"A-3 30",
"A-3",
"A-3",
"G-3 20",
"A-3",
"E-3 40",
"+++",
"+++",
"+++"
))
.eval patternAdd(sb, "05", List().add(
"A-4 10 sawtooth",
"B-4",
"C-5 60",
"+++",
"+++ 20",
"B-4 10",
"C-5",
"D-5 60",
"+++",
"+++ 20",
"E-5 10",
"D-5",
"C-5",
"C-5 60",
"+++ 30",
"B-4 20",
"D-4",
"C-4 60",
"+++",
"+++ 40"
))
.eval patternAdd(sb, "06", List().add(
"A-4 40 pulse-min",
"+++",
"+++",
"+++",
"G-4 -- pulse-maj",
"+++",
"+++",
"+++",
"F-4",
"+++",
"+++",
"+++",
"A-4 -- pulse-min",
"+++",
"+++",
"+++"
))
.eval patternAdd(sb, "07", List().add(
"C-5 60 quietpuls",
"+++",
"+++ 20",
"D-5 10 slide-fff!",
"E-5",
"G-5 60 quietpuls",
"+++",
"+++ 20",
"A-5 10 slide-fff!",
"B-5",
"C-6 -- quietpuls",
"B-5 -- slide-fff!",
"A-5",
"E-5 60 quietpuls",
"+++ 40",
"D-5 10",
"G-4 -- slide-fff!",
"D-4",
"C-4 60 quietpuls",
"+++",
"+++ 40"
))
.eval patternAdd(sb, "08", List().add(
"G-1 10 bs+kick",
"A-1 -- bs+hihat",
"+++",
"A-1 -- bs+kick",
"A-1 -- bs+snare",
"+++",
"A-1 -- bs+hihat",
"G-1 -- bs+kick",
"+++",
"A-1",
"+++",
"A-1",
"A-1 -- bs+snare",
"+++",
"A-1 -- bs+hihat",
"A-1"
))
.eval patternAdd(sb, "09", List().add(
"G-1 10 bs+kick",
"A-1 -- bs+hihat",
"+++",
"A-1 -- bs+kick",
"A-1 -- bs+snare",
"+++",
"A-1 -- bs+hihat",
"G-1 -- bs+kick",
"+++",
"A-1",
"+++",
"A-1",
"A-1 -- bs+snare",
"+++",
"A-1",
"A-1"
))
.eval patternAdd(sb, "0A", List().add(
"G-4 40 pulse-maj",
"+++",
"+++",
"+++",
"F-4",
"+++",
"+++",
"+++",
"A-4 -- pulse-min",
"+++",
"+++",
"+++",
"E-4",
"+++",
"+++",
"+++"
))
.eval patternAdd(sb, "0B", List().add(
"G-3 60 pulsl+vib",
"+++ 20",
"A-3 35",
"A#3 05 slide-fff!",
"B-3 10",
"+++ 30",
"C-4 10 pulsl+vib",
"A-3 60",
"+++ 10",
"--- 40",
"G-3 30",
"A-3 05 slide-fff!",
"G-3",
"E-3 60 pulsl+vib",
"+++ 20",
"--- 50",
"D-3 10",
"C-3 -- slide-fff!",
"D-3",
"D-3 03 pulsl+vib",
"E-3 07 slide-040!",
"D-3 20 slide-fff!",
"+++ 60",
"+++ 30",
"--- 40"
))
.eval patternAdd(sb, "0C", List().add(
"G-3 60 pulsl+vib",
"+++ 20",
"A-3 35",
"A#3 05 slide-fff!",
"B-3 10",
"+++ 30",
"C-4 10 pulsl+vib",
"A-3 60",
"+++ 10",
"--- 50",
"A-3 10",
"C-4 -- slide-fff!",
"D-4",
"D-4 03 pulsl+vib",
"E-4 17 slide-040!",
"+++ 60",
"+++ 50",
"D-4 10 slide-fff!",
"C-4",
"D-4",
"D-4 03 pulsl+vib",
"E-4 17 slide-040!",
"+++ 46",
"F-4 04 slide-fff!",
"F#4",
"G-4 16",
"+++ 60",
"+++ 10"
))
.eval songAdd(sb, "loop1", "loop2", "loop3", List().add(
"loop1:",
"tra 0",
"pat 02",
"pat 02",
"pat 02",
"pat 02",
"pat 08",
"tra -2",
"pat 08",
"tra 5",
"pat 08",
"tra 0",
"pat 08",
"pat 08",
"tra -2",
"pat 08",
"tra 5",
"pat 08",
"tra 0",
"pat 08",
"pat 08",
"tra -2",
"pat 08",
"tra 5",
"pat 08",
"tra 0",
"pat 08",
"pat 08",
"tra -2",
"pat 08",
"tra 5",
"pat 08",
"tra 0",
"pat 08",
"tra -2",
"pat 08",
"tra -4",
"pat 08",
"tra 0",
"pat 08",
"tra -2",
"pat 08",
"pat 08",
"tra -4",
"pat 08",
"tra 0",
"pat 08",
"tra 7",
"pat 09",
"tra 2",
"pat 08",
"tra 0",
"pat 08",
"tra 7",
"pat 08",
"tra 2",
"pat 08",
"pat 08",
"tra 0",
"pat 08",
"tra 7",
"pat 08",
"tra 2",
"pat 08",
"pat 08",
"tra 0",
"pat 08",
"tra 7",
"pat 08",
"tra 2",
"pat 08",
"pat 08",
"tra 0",
"pat 08",
"tra 7",
"pat 08",
"tra 2",
"pat 09",
"jmp loop1",
"loop2:",
"tra 0",
"pat 03",
"pat 05",
"pat 06",
"pat 07",
"pat 03",
"pat 05",
"pat 06",
"pat 07",
"pat 0A",
"pat 0A",
"tra 2",
"pat 03",
"pat 05",
"pat 06",
"pat 07",
"jmp loop2",
"loop3:",
"tra 0",
"pat 04",
"pat 04",
"pat 04",
"pat 04",
"pat 04",
"pat 04",
"pat 04",
"pat 04",
"pat 0B",
"pat 0C",
"tra 2",
"pat 04",
"pat 04",
"pat 04",
"pat 04",
"jmp loop3"
))
.eval songAdd(sb, "loop1", "loop2", "loop3", List().add(
"loop1:",
"pat 01",
"jmp loop1",
"loop2:",
"pat 01",
"jmp loop2",
"loop3:",
"pat 01",
"jmp loop3"
))
.eval songBookEnd(sb)
}
musicdata:
songBookDump(sb)
| 22.293233 | 78 | 0.26484 | [
"Unlicense",
"MIT"
] | lavacablasa/ninja-tracker-kickass | example.asm | 11,860 | Assembly |
Name: zel_title.asm
Type: file
Size: 163262
Last-Modified: '2016-05-13T04:27:09Z'
SHA-1: 05BB26A11E4BF9326B9400BC7345CDB8040D8A43
Description: null
| 21.142857 | 47 | 0.817568 | [
"MIT"
] | prismotizm/gigaleak | other.7z/SFC.7z/SFC/ソースデータ/ゼルダの伝説神々のトライフォース/NES_Ver2/us_asm/zel_title.asm | 148 | Assembly |
; A000142: Factorial numbers: n! = 1*2*3*4*...*n (order of symmetric group S_n, number of permutations of n letters).
; 1,1,2,6,24,120,720,5040,40320,362880,3628800,39916800,479001600,6227020800,87178291200,1307674368000,20922789888000,355687428096000,6402373705728000,121645100408832000,2432902008176640000,51090942171709440000,1124000727777607680000,25852016738884976640000,620448401733239439360000,15511210043330985984000000,403291461126605635584000000,10888869450418352160768000000,304888344611713860501504000000,8841761993739701954543616000000,265252859812191058636308480000000,8222838654177922817725562880000000,263130836933693530167218012160000000
mov $1,1
lpb $0
mul $1,$0
sub $0,1
lpe
mov $0,$1
| 70.9 | 536 | 0.863188 | [
"Apache-2.0"
] | ckrause/cm | programs/oeis/000/A000142.asm | 709 | Assembly |
BITS 32
;TEST_FILE_META_BEGIN
;TEST_TYPE=TEST_F
;TEST_IGNOREFLAGS=FLAG_OF|FLAG_SF|FLAG_ZF|FLAG_AF|FLAG_PF|FLAG_CF
;TEST_FILE_META_END
; allocate 16 byte aligned stack space for the packed values
lea ecx, [esp-17]
and ecx, 0xfffffff0
; load 128 bit value into xmm0
mov DWORD [ecx], 0x12345678
mov DWORD [ecx+4], 0x55555555
mov DWORD [ecx+8], 0xdeadbeef
mov DWORD [ecx+12], 0x1f311c47
movaps xmm0, [ecx]
lea ecx, [ecx+16]
;TEST_BEGIN_RECORDING
lea ecx, [esp-17]
and ecx, 0xfffffff0 ; using this requires us to ignore ALU flags
mov DWORD [ecx], 0xabcdef12
mov DWORD [ecx+4], 0xaaaaaaaa
mov DWORD [ecx+8], 0xdeadbeef
mov DWORD [ecx+12], 0xfeeb1e01
psubd xmm0, [ecx]
mov ecx, [ecx]
mov ecx, 0
;TEST_END_RECORDING
cvtsi2sd xmm0, ecx
| 21.676471 | 65 | 0.75848 | [
"BSD-3-Clause"
] | 0xDEC0DE8/mcsema | mc-sema/validator/x86/tests/PSUBDrm.asm | 737 | Assembly |
COMMENT @----------------------------------------------------------------------
Copyright (c) GeoWorks 1994 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: Desktop/Util
FILE: cutilFileOpHigh.asm
ROUTINES:
INT CopyMoveFileToDir - common routine to do high-level move/copy
INT DeskFileCopy - copy file or directory!!
INT FileCopyFile - copy single file
INT DeskFileMove - move file or directory!!
INT FileMoveFile - move single file
INT FileCopyMoveDir - recursively move/copy directory
INT GetNextFilename - parse filename list
REVISION HISTORY:
Name Date Description
---- ---- -----------
dlitwin 10/10/94 Broken out of cutilFileOp.asm
DESCRIPTION:
This file contains desktop utility routines.
$Id: cutilFileOpHigh.asm,v 1.2 98/06/03 13:51:03 joon Exp $
------------------------------------------------------------------------------@
FileOpLow segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
VerifyMenuDeleteThrowAway
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: use high-level verification of delete if "confirm delete
single" option is set
CALLED BY: ProcessDragFilesCommon
PASS: ax - MSG_FM_START_DELETE or MSG_FM_START_THROW_AWAY
RETURN: carry clear if okay to continue delete
carry set to cancel delete
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 06/07/90 broken out of FolderStartDelete for use in
TreeStartDelete
dlitwin 06/01/92 made it general for throw away and delete
dlitwin 07/01/92 new three stage delete warnings
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
VerifyMenuDeleteThrowAway proc far
if (not _FCAB and not _ZMGR)
uses ax, bx, cx, dx, di, si, bp
.enter
push ax ; save incoming message
GM< mov bx, handle OptionsDeleteWarnings >
GM< mov si, offset OptionsDeleteWarnings >
GM< mov cx, mask OMI_SINGLE_WARNING >
GM< mov ax, MSG_GEN_BOOLEAN_GROUP_IS_BOOLEAN_SELECTED >
GM< call ObjMessageCall >
GM< pop ax ; restore incoming mesage >
GM< jnc done ; no high-level confirm >
GM< ; (continue delete) >
ND< mov bx, handle FileDeleteOptionsGroup >
ND< mov si, offset FileDeleteOptionsGroup >
ND< mov ax, MSG_GEN_ITEM_GROUP_GET_SELECTION >
ND< call ObjMessageCall >
ND< cmp ax, OCDL_SINGLE >
ND< pop ax >
ND< jne continueDelete ; no high-level confirm >
ND< ; (continue delete) >
cmp ax, MSG_FM_START_DELETE
mov ax, WARNING_DELETE_ITEMS ; else, give high-level confirm
je gotWarningMsg
mov ax, WARNING_THROW_AWAY_ITEMS ; else, give high-level confirm
gotWarningMsg:
call DesktopYesNoWarning
cmp ax, YESNO_YES ; delete?
stc ; assume cancel
jne done ; nope, cancel
ND<continueDelete:>
clc ; else, return carry clear
done:
.leave
else
clc ; File Cabinet and Zoomer are always in "full" mode
endif ; ((not _FCAB) and (not _ZMGR) and (not _NIKE))
ret
VerifyMenuDeleteThrowAway endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
MenuMoveCommon, MenuCopyCommon
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: handle file move/copy from menu
CALLED BY: INTERNAL
FolderStartMove
FolderStartCopy
TreeStartMove
TreeStartCopy
PASS: bx = file list buffer
RETURN: errors handled
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 05/08/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
MenuMoveCommon proc far
mov ax, handle MoveToEntry
mov si, offset MoveToEntry
mov bp, mask CQNF_MOVE
call MenuMoveCopyCommon
ret
MenuMoveCommon endp
if not _FCAB
MenuRecoverCommon proc far
push ds
mov cx, PATH_BUFFER_SIZE
sub sp, cx
mov dx, ss
mov bp, sp
push bx ; save file list block
mov ax, MSG_GEN_FILE_SELECTOR_GET_DESTINATION_PATH
mov bx, handle RecoverToEntry
mov si, offset RecoverToEntry
call ObjMessageCall ; dx:bp = path, cx = disk handle
pop bx ; restore file list block
mov ds, dx
mov si, bp
mov dx, cx ; put disk handle in dx
call IsThisInTheWastebasket
pop ds
jc inWastebasket
add sp, PATH_BUFFER_SIZE
mov ax, handle RecoverToEntry
mov si, offset RecoverToEntry
mov bp, mask CQNF_MOVE
call MenuMoveCopyCommon
jmp exit
inWastebasket:
add sp, PATH_BUFFER_SIZE
mov ax, ERROR_RECOVER_TO_WASTEBASKET
call DesktopOKError
exit:
ret
MenuRecoverCommon endp
endif ; if (not _FCAB)
MenuCopyCommon proc far
mov ax, handle CopyToEntry
mov si, offset CopyToEntry
mov bp, mask CQNF_COPY
call MenuMoveCopyCommon
ret
MenuCopyCommon endp
;
; pass:
; ax:si = file selector for destination
; bp = mask CQNF_MOVE for move
; or
; mask CQNF_COPY for copy
; bx = file list transfer buffer
;
MenuMoveCopyCommon proc near
;
; set up parameters for move
;
mov cx, PATH_BUFFER_SIZE
sub sp, cx
mov dx, sp
push bp ; save move/copy flag
push bx ; save file list buffer
mov bp, dx
mov dx, ss
mov bx, ax ; bx:si = file selector
mov ax, MSG_GEN_FILE_SELECTOR_GET_DESTINATION_PATH
call ObjMessageCall ; dx:bp = path, cx = disk handle
;
; move files
;
pop bx ; bx = file list buffer
mov ds, dx ; ds:si = dest. path
mov si, bp
pop ax ; ax = move/copy flag
jcxz done ; => no path, so do nothing
mov dx, cx ; dx = dest. disk handle
mov cx, 1 ; bx is heap block
mov bp, ax ; pass file move/copy flag
push bx
if not _FCAB
call IsThisInTheWastebasket
jnc notTheWastebasket
mov {byte} ss:[usingWastebasket], WASTEBASKET_WINDOW
notTheWastebasket:
endif ; if (not _FCAB)
call ProcessDragFilesCommon ; (handles/reports errors)
mov {byte} ss:[usingWastebasket], NOT_THE_WASTEBASKET
pop bx
done:
call MemFree ; free file list buffer
add sp, PATH_BUFFER_SIZE
ret
MenuMoveCopyCommon endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GetQuickTransferMethod
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: determine whether quick transfer move or copy should be done
CALLED BY: INTERNAL
DriveToolCopyMoveFiles (FileOperation)
DesktopDirToolQTInternal (FileOperation)
FolderUpDirQT (FileOperation)
PASS: dx = destination disk handle
bx = file list block
RETURN: carry - set on error
- clear otherwise
bp = mask CQNF_MOVE or mask CQNF_COPY
depending on (src = dest)
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 05/31/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GetQuickTransferMethod proc far
uses ax, cx, dx, es
.enter
call MemLock
mov es, ax
call ShellGetRemoteFlagFromFQT
tst ax
jz fileIsLocal
call MemUnlock
jmp setToCopy
fileIsLocal:
call ShellGetTrueDiskHandleFromFQT
call MemUnlock
jnc noError
call DesktopOKError
stc ; carry - set
jmp done
noError:
test dx, DISK_IS_STD_PATH_MASK
jz compareThem
NOFXIP< segmov es, <segment idata>, dx >
FXIP< mov dx, bx >
FXIP< GetResourceSegmentNS dgroup, es, TRASH_BX >
FXIP< mov bx, dx >
mov dx, es:[geosDiskHandle] ; SP's are on the system disk
compareThem:
cmp cx, dx
mov bp, mask CQNF_MOVE
clc ; clear out error flag
je done
setToCopy:
mov bp, mask CQNF_COPY
done:
.leave
ret
GetQuickTransferMethod endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
StuffUIFAIntoFileList
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: store UIFA flags into file list header
CALLED BY: INTERNAL
ProcessDragFilesListItem
ProcessTreeDragItem
PASS: bx:ax = VM block containing file list
dh = UIFA flags
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 06/26/90 Initial version
dloft 10/7/92 Changed dx to dh so as not to dork the
BATransferType record.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
StuffUIFAIntoFileList proc far
uses ax, es, bp
.enter
call VMLock
mov es, ax
mov es:[FQTH_UIFA].high, dh
call VMUnlock
.leave
ret
StuffUIFAIntoFileList endp
if not _FCAB
FileOpLow ends
PseudoResident segment resource
; Moved this here so that FileOpLow isn't loaded on startup -chrisb
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
IsThisInTheWastebasket
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Checks if the destination path (dx,ds:si) is the Wastebasket
or if it is in the Wastebasket
CALLED BY: FolderUpDirQT (FolderClass)
ProcessDragFileListItem (FolderClass)
ProcessTreeDragItem (TreeClass)
DesktopDirToolQTInternal
DriveToolCopyMoveFiles
MenuMoveCopyCommon ({Folder,Tree}Start{Move,Copy})
PASS: ds:si = pathname
dx = disk handle
RETURN: carry set if path is the Wastebasket or in the Wastebasket
zero flag set if it is the Wastebasket itself and not a subdir
DESTROYED: none
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
dlitwin 5/27/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
IsThisInTheWastebasket proc far
uses ax, bx, cx, dx, bp, di, si, es, ds
.enter
mov cx, size PathName
mov bp, sp ; save pre-stack-buf. position
sub sp, cx ; allocate stack buffer
segmov es, ss, di
mov di, sp ; es:di is destination buffer
mov bx, dx ; bx, ds:si is source path
clr dx ; no drive name requested
call FileConstructActualPath
mov di, sp ; reset es:di to buffer start
call FileParseStandardPath ; bx, es:di is path to parse
cmp ax, SP_WASTE_BASKET
clc ; assume not equal
jne exit
SBCS < cmp {byte} es:[di], 0 >
DBCS < cmp {wchar}es:[di], 0 >
je setZeroFlag ; if no tail path
SBCS < cmp {word} es:[di], C_BACKSLASH or (0 shl 8) >
DBCS < cmp {wchar}es:[di], C_BACKSLASH >
DBCS < jne haveTail >
DBCS < cmp {wchar}es:[di][2], 0 >
je setZeroFlag ; if no tail path
DBCS <haveTail: >
cmp ax, SP_TOP ; we know its SP_WASTE_BASKET
jmp doneZeroFlag ; so this will clear z flag
setZeroFlag:
sub ax, ax ; sets zero flag
doneZeroFlag:
stc
exit:
mov sp, bp ; pop path buffer off stack
.leave
ret
IsThisInTheWastebasket endp
PseudoResident ends
FileOpLow segment resource
endif ;if (not _FCAB)
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ProcessDragFilesCommon
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: common handler for move/copy of files being quick transfer'ed
CALLED BY: INTERNAL
FolderUpDirQT (FolderClass)
ProcessDragFileListItem (FolderClass)
ProcessTreeDragItem (TreeClass)
DesktopDirToolQTInternal
DriveToolCopyMoveFiles
MenuMoveCopyCommon ({Folder,Tree}Start{Move,Copy})
PASS: ds:si = destination pathname for move/copy
dx = disk handle of destination disk
bp = mask CQNF_MOVE for move
or
mask CQNF_COPY for copy
bx:ax = (VM file):(VM block) of quick transfer file list block
OR
bx = memory block handle of quick transfer file list block
cx = 0 if bx:ax = VM block
<> 0 if bx = memory block
RETURN: nothing
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 01/19/90 broken out for common use
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
messageTable word \
0, ; FOPT_NONE
MSG_SHELL_OBJECT_DELETE, ; FOPT_DELETE
MSG_SHELL_OBJECT_THROW_AWAY, ; FOPT_THROW_AWAY
MSG_SHELL_OBJECT_COPY, ; FOPT_COPY
MSG_SHELL_OBJECT_MOVE ; FOPT_MOVE
.assert (size messageTable eq FileOperationProgressTypes)
ProcessDragFilesCommon proc far
quickNotifyFlags local ClipboardQuickNotifyFlags \
push bp
.enter
pusha ; save VM block handle, block type
mov cx, ds
call MemSegmentToHandle ; cx = handle
EC < ERROR_NC -1 >
push cx ; save block handle
mov ax, ACTIVE_TYPE_FILE_OPERATION
call DesktopMarkActive ; application will be active
call MemDerefStackDS ; flags preserved
popa ; retrieve VM block handle, block type
LONG jnz realExit ; detaching already, do nothing
call FileBatchChangeNotifications ; batch them all up, please
; as we don't want to consume
; billions of handles
call IndicateBusy
call InitForWindowUpdate
;
; whatever the operation, clear recursive error flag - brianc 5/24/93
;
mov ss:[recurErrorFlag], 0
;
; set destination directory as current directory
;
push bx, ax ; save file list block handle
mov bx, dx
mov dx, si ; ds:dx = destination dir
mov di, bx ; save diskhandle in di
call FileSetCurrentPath
pop bx, dx ; retrieve file list block
jnc noError ; if no error, continue
ND< call NDCheckIfDriveLink >
preError::
call DesktopOKError ; else, report error
jmp exit ; then quit
noError:
mov ax, dx ; bx:ax = VM transfer item
;
; go through filenames
;
jcxz lockVMBlock
push bx ; save mem handle for unlocking
call MemLock ; ax = segment
jmp short lockCommon
lockVMBlock:
mov di, bp ; save frame pointer
call VMLock ; ax = segment, bp = mem handle
push bp ; save mem handle for unlocking
mov bp, di ; retrieve frame pointer
lockCommon:
push cx ; save block flag
mov ds, ax ; ds = file list block
; **NewDesk Only**
; If there are items in the incoming list of files that need
; to be handled specially by a NewDesk system object (printer or
; wastebasket etc.) or a BA subclass, this routine breaks each file
; out and calls a subclassable message on it that allows a BA subclass
; to do anything it wants with the special object.
;
ND< call NewDeskHandleSpecialObjects >
;
; set up file-operation progress box
; bp = quick method
; (give precendence to force-COPY if both set)
;
mov ax, FOPT_COPY ; assume copy
test ds:[FQTH_UIFA], (mask UIFA_COPY shl 8) ; explicit copy?
jnz 2$ ; yes, use copy
test ds:[FQTH_UIFA], (mask UIFA_MOVE shl 8) ; explicit move?
jnz 1$ ; yes, use move
test quickNotifyFlags, mask CQNF_COPY ; else, implicit copy?
jnz 2$ ; yes
1$:
mov ax, FOPT_MOVE ; else, move
2$:
cmp {byte} ss:[usingWastebasket], NOT_THE_WASTEBASKET
je gotType
if not _FORCE_DELETE
mov ax, FOPT_THROW_AWAY ; Wastebasket is always a move
;
; This code disables Delete override of the Alt key because someone
; might be forcing a move (Alt key as well) and accidentally drop
; a file on the open Wastebasket folder, causing a delete. This
; is the way things were originally spec'ed, but it was decided that
; it is too inconsistent to have Delete Override and the Wastebasket
; Never Saves work only some of the time (only with the Wastebasket
; dir button, which doesn't even exist in NewDesk).
; Comment it back in if it is decided that this is desired.
;
; cmp {byte} ss:[usingWastebasket], WASTEBASKET_WINDOW
; je gotType
;
test ds:[FQTH_UIFA], (mask UIFA_MOVE shl 8)
jnz deleteOverride
; allow overridding
; OMI_WB_NEVER_SAVES
test ds:[FQTH_UIFA], (mask UIFA_COPY shl 8)
jnz gotType
push ax, bx, cx, dx, bp, si
mov bx, handle OptionsList
mov si, offset OptionsList
mov cx, mask OMI_WB_NEVER_SAVES
mov ax, MSG_GEN_BOOLEAN_GROUP_IS_BOOLEAN_SELECTED
call ObjMessageCall ; carry set if item set
pop ax, bx, cx, dx, bp, si
;
; Blech. GeoManager Menu reviews decided that "Hold Items in WB"
; sounded better than "WB Never Saves", and so this flag means the
; exact opposite of what it says in GMGR. Wizard can't change to
; agree with GMGR, so GMGR will just use this flag but always do
; the opposite.
;
GM< jc gotType >
ND< jnc gotType >
deleteOverride:
endif ; if (not _FORCE_DELETE)
mov ax, FOPT_DELETE
gotType:
;
; Figure out which message to send, based on the
; FileOperationProgressTypes
;
mov dx, ax ; FileOperationProgressTypes
mov_tr bx, ax
mov ax, cs:[messageTable][bx]
;
; Get the type of the first object in the block, and send the
; message to process similar files
;
tst ds:[FQTH_numFiles]
jz outtaHere
mov si, offset FQTH_files
mov si, ds:[si].FOIE_info
call UtilGetDummyFromTable ; ^lbx:si - dummy
push ax, dx, bp
mov cx, ds
mov di, mask MF_CALL
call ObjMessage
pop ax, dx, bp
outtaHere:
pop cx ; retrieve block flag
jcxz vmBlockUnlock
pop bx ; bx = mem handle
call MemUnlock ; unlock file list mem block
jmp exit
vmBlockUnlock:
mov di, bp ; save frame pointer
pop bp ; bp = VM mem handle
call VMUnlock ; unlock file list VM block
mov bp, di ; restore frame pointer
exit:
call FinishUpCommon
realExit:
.leave
ret
ProcessDragFilesCommon endp
if _NEWDESK
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
NDCheckIfDriveLink
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Checks to see if a file is a drive link. If so it changes
the error message accordingly.
CALLED BY: ProcessDragFilesCommon
PASS: ds:si - path of file
di - diskhandle of file
ax - error message from FileSetCurrentPath
RETURN: ax - new error message if it is a drive link
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
dlitwin 6/ 9/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
NDCheckIfDriveLink proc near
uses bx, cx, dx, di, es
cmp ax, ERROR_PATH_NOT_FOUND
jne dontCheck
.enter
call FilePushDir
push ax, ds ; save error and path
mov bx, di
segmov ds, cs, dx
mov dx, offset rootPath
call FileSetCurrentPath ; change dir to root of drive
pop ax, ds ; restore error and path
jc exit
push ax ; save error message
mov dx, si ; ds:dx is filename
segmov es, ss, di
mov cx, size NewDeskObjectType
sub sp, cx
mov di, sp ; es:di is stack buffer buffer
mov ax, FEA_DESKTOP_INFO
call FileGetPathExtAttributes
mov cx, ds:[di] ; get the file's WOT into cx
add sp, size NewDeskObjectType
pop ax ; restore error message
jc exit
cmp cx, WOT_DRIVE
jne exit
mov ax, ERROR_DRIVE_LINK_TARGET_GONE
exit:
call FilePopDir
.leave
dontCheck:
ret
NDCheckIfDriveLink endp
LocalDefNLString rootPath <C_BACKSLASH, 0>
endif ; if _NEWDESK
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
WastebasketDeleteFiles
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: delete files
CALLED BY: INTERNAL
FolderStartDelete (same module)
TreeStartDelete (diff. module)
PASS: bx = mem handle of file list block
RETURN: nothing
DESTROYED: none
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 12/18/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
WastebasketDeleteFiles proc far
uses ax, bx, cx, dx, bp, di, si, ds, es
.enter
mov ax, ACTIVE_TYPE_FILE_OPERATION
call DesktopMarkActive ; application will be active
jnz done
call FileBatchChangeNotifications ; batch them all up, please
; as we don't want to consume
; billions of handles
call IndicateBusy
call InitForWindowUpdate
call MemLock
push bx
mov ds, ax
mov_tr cx, ax
mov ax, MSG_SHELL_OBJECT_DELETE
LoadBXSI DefaultDummy
clr di
call ObjMessage
call FileFlushChangeNotifications
pop bx
call MemUnlock
call FinishUpCommon
mov ss:[showDeleteProgress], TRUE ; be sure delete progress is
; enabled when we leave
done:
.leave
ret
WastebasketDeleteFiles endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FinishUpCommon
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Common code to finish up a multi-file operation
CALLED BY: ProcessDragFilesCommon, WastebasketDeleteFiles
PASS: nothing
RETURN: nothing
DESTROYED: ax,bx,cx,dx,si,di,bp,ds,es
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
chrisb 2/10/93 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
FinishUpCommon proc near
.enter
mov ax, SP_TOP ; just go to top-level
call FileSetStandardPath
call ClearFileOpProgressBox
call IndicateNotBusy
call MarkNotActive
call FileFlushChangeNotifications
.leave
ret
FinishUpCommon endp
if _NEWDESK
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CompressFileQuickTransfer
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Given a FileQuickTransfer block remove all entries with no
name (null in the name field).
*** This routine does not attempt to resize (shrink)
the block, just compact the data within the block and update
the count of files ***.
CALLED BY: NewDeskHandleSpecialObjects
PASS: ds - segment of locked down FileQuickTransfer block
RETURN: ds - segment of locked down compressed FQT block
DESTROYED: bx,cx,dx,si,di,bp,es
PSEUDO CODE/STRATEGY:
X is end of compressed section
Y is begining of chunk to move up to X
Z is ending of chunk to move up to X
X = find first marked entry
no files marked? exit!
Y = X
loopTop:
Y = next unmarked entry or end of list
end of list? exit!
Z = next marked entry after Y or end of list
move entries between Y and Z to X
X = X + (|Z - Y|) (increment X to end of compressed)
Y = Z
jmp loopTop
exit!
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
dlitwin 08/18/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
CompressFileQuickTransfer proc near
uses ax
.enter
segmov es, ds, ax
mov di, offset FQTH_files
mov cx, ds:[FQTH_numFiles]
mov bp, cx ; keep number of entries in bp
jcxz done
mov dx, size FileOperationInfoEntry
; di = X, si = Y
;
; X = find first marked entry
;
xLoop:
cmp {byte} ds:[di].FOIE_name, 0
je xSet
add di, dx ; dx is entry size
loop xLoop
;
; no files marked?
;
jmp done ; exit!
xSet: ;
; Y = X
;
mov si, di
loopTop: ; **** loopTop ****
; Y = next unmarked entry or end of list
yLoop:
EC < call ECCheckBounds >
cmp {byte} ds:[si].FOIE_name, 0 ; is entry marked?
jne ySet
add si, dx ; go to next entry
dec bp ; update file count because
loop yLoop ; we just skiped an entry
; end of list? exit!
jmp done
ySet:
mov bx, si ; bx - si is length to copy
zLoop:
cmp {byte} ds:[bx].FOIE_name, 0
je zSet
add bx, dx ; next entry
loop zLoop
; reached end of FileQuickTransfer
zSet:
push cx ; save file entry counter
mov cx, bx
sub cx, si ; get length to copy into cx
;
; move entries between Y and Z to X
;
rep movsb
;
; X (di) is updated properly to be X + |Y - Z|
; Y (si) is updated properly to be Z
; so just loop unless we are done
;
pop cx ; restore Y entry position
jcxz done ; done,if we moved the last file
jmp loopTop
done:
mov ds:[FQTH_numFiles], bp ; reset to new number of files
.leave
ret
CompressFileQuickTransfer endp
endif
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
UtilGetNextInfoEntryOfSameType
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Search forward in the FileQuickTransfer block until we
find a FileOperationInfoEntry of the same type as the
current one. Place a NULL in the filename of the
current entry, to signify that we're finished with it.
CALLED BY: EXTERNAL
PASS: ds:si - FileOperationInfoEntry
RETURN: if found:
carry clear
ds:si - next FileOperationInfoEntry
else:
carry set
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
chrisb 11/11/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
UtilGetNextInfoEntryOfSameType proc far
uses ax,bx,cx,dx
.enter
mov {byte} ds:[si].FOIE_name, 0
;
; Figure out where the block ends
;
mov ax, ds:[FQTH_numFiles]
mov cx, size FileOperationInfoEntry
mul cx
add ax, offset FQTH_files
;
; Get the type of the current element
;
mov bx, ds:[si].FOIE_info
;
; Scan forward for the next element of this type
;
searchLoop:
add si, size FileOperationInfoEntry
cmp si, ax
ja notFound
cmp ds:[si].FOIE_info, bx
jne searchLoop
done:
.leave
ret
notFound:
stc
jmp done
UtilGetNextInfoEntryOfSameType endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PrepFilenameForError
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Stuff current filename into global area for error reporting
(if needed)
CALLED BY: ProcessDragFilesCommon
PASS: ds:si - filename
RETURN: nothingy
DESTROYED: none
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
dlitwin 5/27/92 added this header
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PrepFilenameForError proc far
uses si, es, di, cx
.enter
NOFXIP< segmov es, <segment dgroup>, di >
FXIP< mov di, bx >
FXIP< GetResourceSegmentNS dgroup, es, TRASH_BX >
FXIP< mov bx, di >
mov di, offset dgroup:fileOperationInfoEntryBuffer
mov cx, size fileOperationInfoEntryBuffer
rep movsb
.leave
ret
PrepFilenameForError endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CopyMoveFileToDir
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: copies/moves the specified source file/directory into the
specified destination directory
CALLED BY: ShellObjectMoveCopyEntryCommon
PASS: ds:si - FileOperationInfoEntry of source file
ds: - FileQuickTransferHeader from which to get src dir
current directory is destination directory
ax - update strategy (passed on to MarkWindowForUpdate)
fileOperationInfoEntryBuffer - 32 and 8.3 source name info
RETURN: carry set if error
AX - error
updates folder window table, if no error
ss:[recurErrorFlag] set if recursive operation error
preserves ds, dx, es, di, cx, si, bp
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 8/28/89 Initial version
brianc 9/8/89 Combined TextCopyFile, TextMoveFile
brianc 2/90 rewritten
dlitwin 5/22/92 added support for new Wastebasket
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
CopyMoveFileToDir proc far
updateStrategy local word push ax
uses bx, ds, dx, es, di, cx, si
.enter
mov ss:[enteredFileOpRecursion], 0 ; in case of early error
lea dx, ds:[si].FOIE_name
call CheckRootSrcOperation ; can't copy/move root
LONG jc exit ; if error, handle it
if not _FCAB
cmp {byte} ss:[usingWastebasket], NOT_THE_WASTEBASKET
je doneThrowAwayCheck
;
; If it's a file or link, put up the "throw away file"
; warning, else put up the "throw away directory" warning
;
mov ax, WARNING_THROW_AWAY_FILE ; assume file
call UtilCheckInfoEntrySubdir
jnc gotWastebasketWarning
mov ax, WARNING_THROW_AWAY_DIR
gotWastebasketWarning:
test ds:[si].FOIE_attrs, mask FA_LINK
jz haveWarning
mov ax, WARNING_THROW_AWAY_LINK
haveWarning:
call DeleteWarningCommon
cmp ax, YESNO_YES
je doneThrowAwayCheck
stc
jc exit
doneThrowAwayCheck:
endif ; if (not _FCAB)
;
; check if complete destination file spec. specifies an existing
; file, if so, give replace warning if needed
;
call CopyMoveExistenceCheck ; do battery of checks
jc exit ; if error, exit with err code
;NOTE: we lose update needed for errors deleting existing directory with
;file-busy or access-denied files that are not deleted
;FAIL-CASE: attempt to overwrite directory contain file-in-use. A Folder
;Window on that directory will not get updated to reflect the successfully
;deleted files
segmov es, ds
lea di, ds:[si].FOIE_name ; copy/move to same name in
; destination
ND < cmp {byte} ss:[usingWastebasket], NOT_THE_WASTEBASKET >
ND < jne wastebasketThrowsAwayTemplatesTooYouKnow >
ND < test ds:[si].FOIE_flags, mask GFHF_TEMPLATE ; force copy if >
ND < jnz copyFile ; file is a template >
ND <wastebasketThrowsAwayTemplatesTooYouKnow: ; and NOT throwingaway>
cmp ss:[fileOpProgressType], FOPT_COPY
je copyFile ; if so, do it
call DeskFileMove ; move file to dest path
jmp afterOp ; handle results
copyFile:
call DeskFileCopy ; copy file to dest path
afterOp:
jc exit
mov ax, updateStrategy ; retrieve update strategy
call MarkWindowForUpdate ; pass ds:dx = source
clc
exit:
.leave ; preserves flags
ret
CopyMoveFileToDir endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CopyMoveExistenceCheck
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: checks if file exists
CALLED BY: CopyMoveFileToDir
PASS: ds = FileQuickTransferHeader
ds:si = FileOperationInfoEntry of file being moved/copied
current directory is destination directory
RETURN: carry set if error
ax - error code
carry clear if source file can be copied to destination
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 02/12/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
CopyMoveExistenceCheck proc near
uses bx, cx, dx, ds, si, es, di, bp
.enter
clr ss:[useLocalMoveCopy] ; default to regular copy
;
; check if destination exists
;
lea dx, ds:[si].FOIE_name
call FileRootGetAttributes ; does file exist in dest.?
jnc destExists ; yes
cmp ax, ERROR_FILE_NOT_FOUND ; file doesn't exist in dest.?
je exitJMP ; correct -- exit with carry
; clear
errorExit:
stc
exitJMP:
jmp exit
destExists:
ND< call NDCheckIfNotReplaceable >
ND<LONG jc exit >
;
; Used to check for replacing a parent of the src, but that's handled
; in SetUpCopyMoveParams by the comparison against evilName, which
; was so gracefully set up by CheckSrcDestConflict
;
; We need to check to see if the file we are conflicting with has
; been merged into our directory by the magic or StandardPaths, or
; if it is actually a local file.
;
call IsConflictingFileRemote
LONG jc exit
mov ss:[useLocalMoveCopy], -1
;
; If the file we are copying is a remote file, then it may conflict
; with itself, as it may be mapped into our destination. In this case
; we want to ignore any warnings (as we are just making a local copy
; of what was already mapped in anyway) and just create a local copy,
; so skip to the end of the routine, and later routines will know what
; to do because we pass them the CLT_REMOTE_SELF value.
;
cmp ax, CLT_REMOTE_SELF
clc ; no error...
LONG je exit
;
; If the file isn't conflicting with itself, it is either local or
; is mapped in from another StandardPath tree, so we want to warn
; the user of an overwrite situation. If it is local, we will delete
; the local file, but still want to force a local copy, as the regular
; copy might wind up conflicting with a mapped in remote file that has
; been exposed by the deletion of the local file that was obscuring it.
; If it is mapped in, we don't actually delete anything, and copy
; locally. Because the mapped in copy will be obscured by the new
; local version (which is a different copy), in the eyes of the user
; it is has been overwriten, and therefore we still want the warning.
; Check the CLT_REMOTE_OTHER or CLT_LOCAL later in the routine when
; we decide whether or not to delete the destination.
;
mov bx, ax ; save ConflictLocationType
; across warning
;
; dest exists, ask user if s/he wishes to replace name file
;
if (not _FCAB and not _ZMGR)
call ReplaceWarning
else
mov ax, WARNING_REPLACE_32_FILE ; use 32 name
call DesktopYesNoWarning
endif ; if ((not _FCAB) and (not _ZMGR))
cmp ax, YESNO_YES ; user want to replace?
; (might be DESK_DB_DETACH
; or YESNO_CANCEL)
jne errorExit ; they don't, return cancel
;
; user wishes to replace existing file
;
cmp bx, CLT_REMOTE_OTHER ; no need to delete dest if it
LONG je exit ; is remote...
;
; if not CLT_REMOTE_OTHER, it must be CLT_LOCAL.
;
call CheckThatSourceStillExists ; if the source has been
LONG jc exit ; deleted, cancel operation
;
; Create a fake FileQuickTransfer block
; ds = FileQuickTransferHeader (move/copy source path)
; ds:si = FileOperationInfoEntry (move/copy source filename)
; destination for move/copy = current dir
;
push bx, cx, ds, si
mov ax, size FileQuickTransferHeader + size FileOperationInfoEntry
mov cx, ALLOC_DYNAMIC_LOCK
call MemAlloc ; bx = handle, ax = segment
jnc noMemErr
mov ax, ERROR_INSUFFICIENT_MEMORY
jmp removeExit
noMemErr:
push ds, si ; save incoming FOIE
push bx ; save buffer handle
mov ds, ax
mov ds:[FQTH_nextBlock], 0
mov ds:[FQTH_UIFA], 0
; feedback data and remote flag don't matter because this
; won't be used with a QuickTransfer, just internally.
mov ds:[FQTH_numFiles], 1
mov si, offset FQTH_pathname
mov cx, size FQTH_pathname
call FileGetCurrentPath ; bx = disk handle
mov ds:[FQTH_diskHandle], bx
pop bx ; retreive buffer handle
segmov es, ds ; es:di = FOIE_name
mov di, offset FQTH_files
pop ds, si ; ds:si = incoming FOIE
.assert (offset FOIE_name eq 0)
mov cx, size FOIE_name/2
rep movsw ; copy source name over
segmov ds, es ; ds = new FQTH
mov ds:[FQTH_files].FOIE_flags, 0
mov ds:[FQTH_files].FOIE_info, 0
sub sp, 3 * size FileExtAttrDesc
mov di, sp
segmov es, ss
mov es:[di].FEAD_attr, FEA_FILE_TYPE
mov es:[di].FEAD_value.segment, ds
mov es:[di].FEAD_value.offset, offset FQTH_files.FOIE_type
mov es:[di].FEAD_size, size GeosFileType
add di, size FileExtAttrDesc
mov es:[di].FEAD_attr, FEA_FILE_ATTR
mov es:[di].FEAD_value.segment, ds
mov es:[di].FEAD_value.offset, offset FQTH_files.FOIE_attrs
mov es:[di].FEAD_size, size FileAttrs
add di, size FileExtAttrDesc
mov es:[di].FEAD_attr, FEA_PATH_INFO
mov es:[di].FEAD_value.segment, ds
mov es:[di].FEAD_value.offset, offset FQTH_files.FOIE_pathInfo
mov es:[di].FEAD_size, size DirPathInfo
mov di, sp
mov cx, 3
mov ax, FEA_MULTIPLE
mov dx, offset FQTH_files.FOIE_name
call FileGetPathExtAttributes
EC < WARNING_C WARNING_FILE_ERROR_IGNORED >
add sp, 3 * size FileExtAttrDesc
;
; Turn off delete progress if thing being deleted is a file.
; If it's a directory, it will get turned on again by
; FileDeleteFileDirCommon, which is OK, I suppose...
;
mov ss:[showDeleteProgress], FALSE
mov cx, ss:[fileOpProgressType]
mov ax, FOPT_DELETE
call SetFileOpProgressBox
mov si, offset FQTH_files ; ds:si = new FOIE
call ForceFileDeleteFileDir ; else, del dest
; return with error status
; (might be "cancel")
pushf
call MemFree ; free created FQTH
call RemoveFileOpProgressBox
push ax
mov_tr ax, cx
call SetFileOpProgressBox
pop ax
popf
removeExit:
pop bx, cx, ds, si
exit:
.leave
ret
CopyMoveExistenceCheck endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CheckThatSourceStillExists
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: If the source file has been deleted for some reason, we
don't want to delete the destination and then fail on
the copy or move. Better to just bail out entirely.
CALLED BY: CopyMoveExistenceCheck
PASS: ds = segment of FileQuickTransferBlock of source
ds:dx = filename of source
RETURN: carry = set if source has been deleted
= clear if source is still there
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
dlitwin 8/ 6/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
CheckThatSourceStillExists proc near
uses bx
.enter
call FilePushDir
push dx ; save filename offset
mov bx, ds:[FQTH_diskHandle]
lea dx, ds:[FQTH_pathname]
call FileSetCurrentPath
pop dx ; restore filename offset
jc exit ; bail if there were any
; problems setting the path
call FileRootGetAttributes ; does source exist?
; carry will be set if there
exit: ; is any problem finding the
call FilePopDir ; file
.leave
ret
CheckThatSourceStillExists endp
if _NEWDESK
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
NDCheckIfNotReplaceable
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Checks a file's WOT to see if this is a candidate for being
replaced by another file. Only WOT_FOLDER, WOT_DOCUMENT
and WOT_EXECUTABLE may be replaced.
CALLED BY: CopyMoveExistenceCheck
PASS: ds:dx = filename of item to check
RETURN: carry = set if this item may not be replaced
ax = ERROR_CANNOT_OVERWRITE_THIS_WOT
= clear if it may be replaced
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
dlitwin 8/ 5/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
NDCheckIfNotReplaceable proc near
uses bx,cx,dx,si,di,bp
.enter
segmov es, ss
mov bp, sp ; preserve old stack
mov cx, size NewDeskObjectType
sub sp, cx
mov di, sp
mov ax, FEA_DESKTOP_INFO
call FileGetPathExtAttributes
mov bx, es:[di] ; put WOT in bx
mov sp, bp ; reset stack
jnc checkWOT
;
; if we can't fetch a WOT, this file doesn't have extended
; attributes and therefore is not something we have to worry
; about overwriting. If it failed for other reasons, go ahead
; and error for that reason.
;
cmp ax, ERROR_ATTR_NOT_FOUND
je okToOverwrite
jmp doNotOverwrite
checkWOT:
cmp bx, WOT_FOLDER
je okToOverwrite
cmp bx, WOT_DOCUMENT
je okToOverwrite
cmp bx, WOT_EXECUTABLE
je okToOverwrite
mov ax, ERROR_CANNOT_OVERWRITE_THIS_WOT
doNotOverwrite:
stc ; any other WOT's are sacred
jmp exit
okToOverwrite:
clc
exit:
.leave
ret
NDCheckIfNotReplaceable endp
endif ; if _NEWDESK
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
IsConflictingFileRemote
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Checks to see if the file that we have a conflict with is
a local file, or if it is remote (mapped in because of the StandardPath
merging of trees).
If it is remote, there is the posiblity that it is our source
file, should our source be in a tree that is being mapped to our
destination. In this case we don't want to warn the user of an
overwrite, as we are just copying the same verion that they see in the
destination to actually *be* in the destination instead of being mapped
there, and want to copy/move the file to the local destination.
If it is not our source file, then we want to warn the user
of an overwrite because the file being moved/copied in will obscure the
copy that was being mapped in, effectively 'overwriting' it. We then
want to copy/move it to the local destination.
Should the conflicting file be local, we want to delete it,
but still want to use the FileCopyLocal routine, as the deletion of
the local file might reveal a mapped in remote file that would cause
a regular move/copy to complain.
CALLED BY: CopyMoveExistenceCheck
PASS: ds = FileQuickTransferHeader
ds:si = FileOperationInfoEntry of file being moved/copied
current directory is destination directory
RETURN: carry = clear if no error
ax = ConflictLocationType
ss:[useLocalMoveCopy] updated correctly
= set on error
ax = FileError
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
dlitwin 10/14/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
IsConflictingFileRemote proc near
uses bx,cx,dx,si,di
attrArray local 3 dup (FileExtAttrDesc)
srcDisk local word
srcID local dword
destDisk local word
destID local dword
destPathInfo local DirPathInfo
.enter
mov ax, ss
lea bx, ss:[destDisk]
lea cx, ss:[destID]
lea dx, ss:[destPathInfo]
;
; Diskhandle FEAD
;
mov ss:[attrArray].FEAD_attr, FEA_DISK
mov ss:[attrArray].FEAD_value.segment, ax
mov ss:[attrArray].FEAD_value.offset, bx ; destDisk is buffer
mov ss:[attrArray].FEAD_size, word
;
; FileID FEAD
;
add bp, size FileExtAttrDesc ; next FEAD
mov ss:[attrArray].FEAD_attr, FEA_FILE_ID
mov ss:[attrArray].FEAD_value.segment, ax
mov ss:[attrArray].FEAD_value.offset, cx ; destID is buffer
mov ss:[attrArray].FEAD_size, dword
;
; PathInfo FEAD
;
add bp, size FileExtAttrDesc ; next FEAD
mov ss:[attrArray].FEAD_attr, FEA_PATH_INFO
mov ss:[attrArray].FEAD_value.segment, ax
mov ss:[attrArray].FEAD_value.offset, dx ; destPathInfo is buffer
mov ss:[attrArray].FEAD_size, size DirPathInfo
sub bp, 2 * (size FileExtAttrDesc) ; restore bp
segmov es, ss, di
lea di, ss:[attrArray] ; es:di is FEAD array
mov dx, si ; ds:dx is filename
;
; grab the attributes of the destination
;
mov ax, FEA_MULTIPLE
mov cx, 3 ; get all three attributes
call FileGetPathExtAttributes
jc exit
test ss:[destPathInfo], mask DPI_EXISTS_LOCALLY
mov ax, CLT_LOCAL
clc ; no error
jnz exit
;
; grab the attributes of the source
;
call FilePushDir ; save dest directory
mov bx, ds:[FQTH_diskHandle]
mov dx, offset FQTH_pathname
call FileSetCurrentPath ; set source as currentpath
jc popDirAndExit
lea ax, ss:[srcDisk]
lea bx, ss:[srcID]
mov ss:[attrArray].FEAD_value.offset, ax ; buffer is srcDisk
add bp, size FileExtAttrDesc ; next FEAD
mov ss:[attrArray].FEAD_value.offset, bx ; buffer is srcID
sub bp, size FileExtAttrDesc ; restore bp
mov dx, si ; ds:dx is filename
mov ax, FEA_MULTIPLE
mov cx, 2 ; we only want disk and fileID
call FileGetPathExtAttributes
popDirAndExit:
call FilePopDir ; restore dest directory
jc exit
;
; OK, so now we have the attributes we want...
;
mov ax, CLT_REMOTE_OTHER ; assume different files...
mov bx, ss:[srcDisk]
cmp bx, ss:[destDisk]
clc ; no error
jne exit
movdw bxcx, ss:[srcID]
cmpdw bxcx, ss:[destID]
clc ; no error
jne exit
mov ax, CLT_REMOTE_SELF
exit:
.leave
ret
IsConflictingFileRemote endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeskFileCopy
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: copy file/directory
CALLED BY: CopyMoveFileToDir
PASS: ds:si = FileOperationInfoEntry for source
(file or directory)
ds:0 = FileQuickTransferHeader containing source dir
es:di = name for destination
current directory is destination directory
RETURN: carry set if error
carry clear otherwise
ax - error code
ss:[recurErrorFlag] set if recursive operation error
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
if (file to copy is not a directory) {
FileCopyFile(source pathname,
complete destination pathname);
} else {
FileCreateDir(complete destination pathname);
for each file X in directory {
DeskFileCopy("source pathname/X",
"complete destination pathname/X");
}
}
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 9/1/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeskFileCopy proc far
.enter
mov ss:[dirCopyMoveRoutine], offset FileCopyFile
call CopyMoveFileOrDir
.leave
ret
DeskFileCopy endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DeskFileMove
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: move file to new directory
CALLED BY: CopyMoveFileToDir
PASS: ds:si = FileOperationInfoEntry for source
(file or directory)
ds:0 = FileQuickTransferHeader containing source dir
es:di = name for destination
current directory is destination directory
RETURN: carry set if error
carry clear otherwise
ax - error code
ss:[recurErrorFlag] set if recursive operation error
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
if (file to move is not a directory) {
FileMoveFile(source pathname,
complete destination pathname);
} else {
FileCreateDir(complete destination pathname);
for each file X in directory {
FileMove("source pathname/X",
"complete destination pathname/X");
}
}
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 8/31/89 Initial version
brianc 10/30/89 use FileMoveFile instead of FileRename
so different drives are supported
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DeskFileMove proc far
.enter
mov ss:[dirCopyMoveRoutine], offset FileMoveFile
call CopyMoveFileOrDir
.leave
ret
DeskFileMove endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CopyMoveFileOrDir
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Copy or move the current file or directory using a function
that depends on whether it is a file or a directory
CALLED BY: DeskFileCopy, DeskFileMove
PASS: ds:si = FileOperationInfoEntry for source
ds:0 = FileQuickTransferHeader containing source dir
es:di = name for destination
current dir is destination directory
ax = ConflictLocationType
ss:[dirCopyMoveRoutine] = routine to call if source is a file
RETURN: carry set on error:
ax = error code
carry clear if success:
ax = destroyed
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 2/26/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
CopyMoveFileOrDir proc near
uses bx, cx, dx, ds, es, si, di, bp
.enter
if ENSURE_LOCAL_SP_SUBDIRS
;
; Ensure that subdirs of Standard Paths exists locally
;
call EnsureLocalStandardPathSubdirs
endif
;
; See if the source is a directory or file and react accordingly
;
call UtilCheckInfoEntrySubdir
jc doDirectory
clr ax ; no enum info yet
call ss:[dirCopyMoveRoutine] ; else, use regular file routine
jmp done
;
; do directory
; ds:si - source FOIE
; es:di - destination filespec
;
doDirectory:
mov ss:[recurErrorFlag], 1
mov ss:[enteredFileOpRecursion], 0 ; no recursion yet
push ds:[FQTH_nextBlock]
clr ds:[FQTH_nextBlock]
call FileCopyMoveDir ; do directory
pop ds:[FQTH_nextBlock]
done:
.leave
ret
CopyMoveFileOrDir endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FileCopyFile
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: copy a single file
CALLED BY: INTERNAL
DeskFileCopy, FileCopyMoveDir
PASS: ds:0 = FileQuickTransferHeader
ds:si = FileOperationInfoEntry
es:di - destination file in current directory
destination file doesn't already exist
RETURN: carry set if error
ax - error code
carry clear if success
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 8/28/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
FileCopyFile proc near
mov ax, offset doAction
push ax
call FileCopyOrMoveFile
ret
doAction:
if TRY_CLOSE_ON_IN_USE_ERROR
push bp
mov bp, 1 ; do copy
call TryCloseFileForMoveCopy
pop bp
endif
tst ss:[useLocalMoveCopy]
jz regularCopy
call FileCopyLocal
jmp afterCopy
regularCopy:
call FileCopy
afterCopy:
retn
FileCopyFile endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FileMoveFile
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: move file
CALLED BY: INTERNAL
CopyMoveFileOrDir,
FileCopyMoveDir
PASS: ds:si - source FOIE
ds:0 = FileQuickTransferHeader
es:di - destination file
current dir is destination dir
RETURN: carry set if error
ax - error code
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 10/30/89 Initial version
dlitwin 11/04/93 added some readonly checks
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
FileMoveFile proc near
call DoRemoteFileCheck
jnc localFile
call FileCopyFile
jmp exit
localFile:
clr ss:[fileMoveSetReadOnly] ; assume not readonly
test ds:[si].FOIE_attrs, mask FA_RDONLY
jz startMove ; if not readonly, don't worry
call FileMoveReadOnlyCheck
jc exit ; readonly, user canceled
cmp ax, YESNO_YES ; if ax = YESNO_YES, user chose
clc ; to move the read only file
jne exit
;
; move the file and reset the readonly bit afterward
;
mov ss:[fileMoveSetReadOnly], -1 ; set reset bit after move
startMove:
mov ax, offset doAction
push ax
call FileCopyOrMoveFile
jc exit
tst ss:[fileMoveSetReadOnly]
jz exit
push ds, dx, cx
segmov ds, es, dx
mov dx, si ; ds:dx is filename
clr ch
mov cl, ds:[si].FOIE_attrs
call FileSetAttributes ; set the readonly bit
pop ds, dx, cx
exit:
ret ; EXIT HERE <------
doAction:
tst ss:[useLocalMoveCopy]
jz regularMove
call DesktopFileMoveLocal ; no FileMoveLocal is currently
jmp afterMove ; supported...
regularMove:
call FileMove
afterMove:
if TRY_CLOSE_ON_IN_USE_ERROR
jnc afterTryClose
push bp
mov bp, 0 ; do move
call TryCloseFileForMoveCopy
pop bp
afterTryClose:
endif
retn
FileMoveFile endp
FileOpLow ends
| 25.489568 | 80 | 0.630544 | [
"Apache-2.0"
] | BOBBYWY/pcgeos | Appl/FileMgrs2/CommonDesktop/CUtil/cutilFileOpHigh.asm | 52,534 | Assembly |
; A200376: G.f.: 1/sqrt(1-10*x^2 + x^4/(1-8*x^2)) + x/(1-9*x^2).
; Submitted by Jamie Morken(s3)
; 1,1,5,9,37,81,301,729,2549,6561,22045,59049,193029,531441,1703469,4782969,15111573,43046721,134539837,387420489,1200901157,3486784401,10739313997,31381059609,96172251061,282429536481,862142190941,2541865828329,7734936371269,22876792454961,69439155241581
mov $1,1
mov $3,$0
lpb $3
sub $3,1
mul $1,$3
add $2,1
div $1,$2
add $4,$1
mul $1,4
sub $3,1
lpe
mov $0,$4
mul $0,4
add $0,1
| 25.894737 | 255 | 0.699187 | [
"Apache-2.0"
] | ckrause/loda-programs | oeis/200/A200376.asm | 492 | Assembly |
; A298030: Partial sums of A298029.
; 1,4,10,22,40,73,112,163,220,289,364,451,544,649,760,883,1012,1153,1300,1459,1624,1801,1984,2179,2380,2593,2812,3043,3280,3529,3784,4051,4324,4609,4900,5203,5512,5833,6160,6499,6844,7201,7564,7939,8320,8713,9112,9523,9940,10369,10804,11251,11704,12169,12640,13123,13612,14113,14620,15139,15664,16201,16744,17299,17860,18433,19012,19603,20200,20809,21424,22051,22684,23329,23980,24643,25312,25993,26680,27379,28084,28801,29524,30259,31000,31753,32512,33283,34060,34849,35644,36451,37264,38089,38920,39763,40612,41473,42340,43219,44104,45001,45904,46819,47740,48673,49612,50563,51520,52489,53464,54451,55444,56449,57460,58483,59512,60553,61600,62659,63724,64801,65884,66979,68080,69193,70312,71443,72580,73729,74884,76051,77224,78409,79600,80803,82012,83233,84460,85699,86944,88201,89464,90739,92020,93313,94612,95923,97240,98569,99904,101251,102604,103969,105340,106723,108112,109513,110920,112339,113764,115201,116644,118099,119560,121033,122512,124003,125500,127009,128524,130051,131584,133129,134680,136243,137812,139393,140980,142579,144184,145801,147424,149059,150700,152353,154012,155683,157360,159049,160744,162451,164164,165889,167620,169363,171112,172873,174640,176419,178204,180001,181804,183619,185440,187273,189112,190963,192820,194689,196564,198451,200344,202249,204160,206083,208012,209953,211900,213859,215824,217801,219784,221779,223780,225793,227812,229843,231880,233929,235984,238051,240124,242209,244300,246403,248512,250633,252760,254899,257044,259201,261364,263539,265720,267913,270112,272323,274540,276769
mov $1,$0
mov $3,$0
mov $0,1
mul $0,$3
trn $1,1
pow $1,2
add $1,1
mov $2,1
add $3,1
lpb $0,1
mov $0,3
mul $2,2
mov $3,2
mov $4,$1
mul $1,2
div $4,$2
lpe
sub $1,$4
sub $1,$2
div $3,$2
add $1,$3
sub $1,1
mul $1,3
add $1,1
| 64.178571 | 1,527 | 0.790762 | [
"Apache-2.0"
] | karttu/loda | programs/oeis/298/A298030.asm | 1,797 | Assembly |
; A167346: Totally multiplicative sequence with a(p) = (p-1)*(p+2) = p^2+p-2 for prime p.
; Submitted by Jon Maiga
; 1,4,10,16,28,40,54,64,100,112,130,160,180,216,280,256,304,400,378,448,540,520,550,640,784,720,1000,864,868,1120,990,1024,1300,1216,1512,1600,1404,1512,1800,1792,1720,2160,1890,2080,2800,2200,2254,2560,2916,3136,3040,2880,2860,4000,3640,3456,3780,3472,3538,4480,3780,3960,5400,4096,5040,5200,4554,4864,5500,6048,5110,6400,5400,5616,7840,6048,7020,7200,6318,7168,10000,6880,6970,8640,8512,7560,8680,8320,8008,11200,9720,8800,9900,9016,10584,10240,9504,11664,13000,12544
add $0,1
mov $1,1
lpb $0
mov $3,$0
lpb $3
mov $4,$0
mov $6,$2
cmp $6,0
add $2,$6
mod $4,$2
cmp $4,0
cmp $4,0
mov $5,$2
add $2,1
cmp $5,1
max $4,$5
sub $3,$4
lpe
mov $3,$2
add $3,2
mov $5,1
lpb $0
dif $0,$2
lpb $3
sub $2,1
mul $5,$3
mov $3,$7
lpe
mul $5,$2
lpe
mul $1,$5
lpe
mov $0,$1
| 25.526316 | 469 | 0.617526 | [
"Apache-2.0"
] | ckrause/loda-programs | oeis/167/A167346.asm | 970 | Assembly |
; Z80 test - officially documented flags, flags only version.
;
; Copyright (C) 2012 Patrik Rak (patrik@raxoft.cz)
;
; This source code is released under the MIT license, see included license.txt.
macro testname
db "doc flags"
endm
maskflags equ 1
onlyflags equ 1
postccf equ 0
memptr equ 0
include main.asm
; EOF ;
| 22.736842 | 79 | 0.553241 | [
"MIT"
] | MaddTheSane/CLK | OSBindings/Mac/Clock SignalTests/Patrik Rak Z80 Tests/src/z80docflags.asm | 432 | Assembly |
; This table translates key presses into ascii codes.
; Also used by 'GetKey' and 'LookupKey'. An effort has been made for
; this key translation table to emulate a PC keyboard with the 'CTRL' key
SECTION rodata_clib
PUBLIC in_keytranstbl
.in_keytranstbl
;Unshifted
; Lower 5 bits only
defb 27, '1', 'q', 'a', ' ' ;K0 1 q a SP
defb 128, '2', 'w', 's', 'y' ;K1 2 w s y
defb 129, '3', 'e', 'd', 'x' ;K2 3 e d x
defb 130, '4', 'r', 'f', 'c' ;K3 4 r f c
defb 131, '5', 't', 'g', 'v' ;K4 5 t g v
defb 132, '6', 'z', 'h', 'b' ;K5 6 z h b
defb 133, '7', 'u', 'j', 'n' ;K6 7 u j n
defb 134, '8', 'i', 'k', 'm' ;K7 8 i k m
defb 135, '9', 'o', 'l', ',' ;K8 9 o l ,
defb 136, '0', 'p', ';', '.' ;K9 0 p ; .
defb 137, '_', '@', ':', '/' ;K10 _ @ : /
defb 138, '{','\\', '[', 255 ;K11 { \ [ UN
defb 139, 255, 12, 255, 255 ;WRK BS LEFT |<- UN
defb 7, 127, 11, 10, 13 ;C-D DEL UP DOWN EOL
defb 141, 142, 9, 255, 13 ;CLR RCL RIGHT ->| EOL2
; KEY15
; defb 255, 255, 255, 255, 255, 255, 255, 255 ; UN UN UN UN UN SHIFT CTRL UN
; Shift
defb 27, '!', 'Q', 'A', ' ' ;K0 1 q a SP
defb 128,'\"', 'W', 'S', 'Y' ;K1 2 w s y
defb 129, '#', 'E', 'D', 'X' ;K2 3 e d x
defb 130, '$', 'R', 'F', 'C' ;K3 4 r f c
defb 131, '%', 'T', 'G', 'V' ;K4 5 t g v
defb 132, '&', 'Z', 'H', 'B' ;K5 6 z h b
defb 133,'\'', 'U', 'J', 'N' ;K6 7 u j n
defb 134, '(', 'I', 'K', 'M' ;K7 8 i k m
defb 135, ')', 'O', 'L', '<' ;K8 9 o l ,
defb 136, '-', 'P', '+', '>' ;K9 0 p ; .
defb 137, '=', '`', '*', '?' ;K10 _ @ : /
defb 138, '}', '^', ']', 255 ;K11 { \ [ UN
defb 139, 127, 8, 255, 255 ;WRK BS LEFT |<- UN
defb 140, 127, 11, 10, 13 ;C-D DEL UP DOWN EOL
defb 141, 142, 9, 255, 13 ;CLR RCL RIGHT ->| EOL2
; Control
defb 27, '1', 17, 1, ' ' ;K0 1 q a SP
defb 128, '2', 23, 19, 25 ;K1 2 w s y
defb 129, '3', 5, 4, 24 ;K2 3 e d x
defb 130, '4', 18, 6, 3 ;K3 4 r f c
defb 131, '5', 20, 7, 22 ;K4 5 t g v
defb 132, '6', 26, 8, 2 ;K5 6 z h b
defb 133, '7', 21, 10, 14 ;K6 7 u j n
defb 134, '8', 9, 11, 13 ;K7 8 i k m
defb 135, '9', 15, 12, ',' ;K8 9 o l ,
defb 136, '0', 16, ';', '.' ;K9 0 p ; .
defb 137, '_', '@', ':', '/' ;K10 _ @ : /
defb 138, '{','\\', '[', 255 ;K11 { \ [ UN
defb 139, 12, 8, 255, 255 ;WRK BS LEFT |<- UN
defb 140, 127, 11, 10, 13 ;C-D DEL UP DOWN EOL
defb 141, 142, 9, 255, 13 ;CLR RCL RIGHT ->| EOL2
| 37.430769 | 76 | 0.465269 | [
"BSD-2-Clause"
] | ByteProject/Puddle-BuildTools | FictionTools/z88dk/libsrc/target/pmd85/input/in_keytranstbl.asm | 2,433 | Assembly |
; A142914: Primes congruent to 44 mod 63.
; Submitted by Jamie Morken(w3)
; 107,233,359,863,1367,1493,1619,1871,1997,2753,2879,3257,3761,4013,4139,4391,4517,4643,5021,5147,5273,5399,5651,5903,6029,6659,6911,7541,7793,7919,8171,8297,8423,9431,10061,10313,10691,11069,11321,11447,11699,12203,12329,12959,13337,13463,13841,13967,14723,15101,15227,15731,16361,16487,17117,17747,18251,18503,19259,19763,19889,20393,20771,20897,21023,21149,21401,22031,22157,22283,22409,22787,23039,23291,23417,23669,24551,24677,25307,26189,26693,27197,27449,27701,27827,27953,28961,29339,29717
mov $1,3
mov $2,$0
add $2,2
pow $2,2
lpb $2
add $1,50
sub $2,1
mov $3,$1
add $1,13
mul $3,2
seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
sub $0,$3
mov $4,$0
max $4,0
cmp $4,$0
mul $2,$4
lpe
mul $1,2
mov $0,$1
sub $0,25
| 33.76 | 497 | 0.725118 | [
"Apache-2.0"
] | ckrause/loda-programs | oeis/142/A142914.asm | 844 | Assembly |
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r14
push %r15
push %r8
push %r9
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_UC_ht+0x10f4f, %r11
nop
nop
nop
nop
dec %r8
movups (%r11), %xmm5
vpextrq $0, %xmm5, %r15
add %rcx, %rcx
lea addresses_normal_ht+0x1909b, %r9
sub $47141, %r15
mov $0x6162636465666768, %r11
movq %r11, %xmm2
movups %xmm2, (%r9)
nop
nop
nop
sub %r15, %r15
lea addresses_WT_ht+0x299b, %r14
nop
and %rax, %rax
movw $0x6162, (%r14)
nop
nop
nop
inc %r11
lea addresses_normal_ht+0x1254f, %rax
clflush (%rax)
add $47713, %r15
mov $0x6162636465666768, %r8
movq %r8, (%rax)
nop
nop
and %rcx, %rcx
lea addresses_A_ht+0x90af, %rsi
lea addresses_WC_ht+0x119cf, %rdi
nop
nop
nop
nop
xor %r11, %r11
mov $15, %rcx
rep movsb
nop
nop
nop
nop
dec %r15
lea addresses_UC_ht+0x1964f, %r9
nop
nop
nop
xor $43359, %rsi
mov (%r9), %cx
nop
dec %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r8
pop %r15
pop %r14
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r13
push %r14
push %r8
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
// Store
lea addresses_WT+0xe827, %r13
nop
nop
add %rdi, %rdi
movl $0x51525354, (%r13)
cmp $53218, %rbp
// Store
mov $0x3cde040000000b4f, %r14
nop
sub %rsi, %rsi
movb $0x51, (%r14)
nop
cmp $53914, %r13
// REPMOV
mov $0x3cde040000000b4f, %rsi
lea addresses_D+0x1cd6f, %rdi
nop
nop
nop
nop
and %r8, %r8
mov $1, %rcx
rep movsb
nop
nop
nop
sub %r13, %r13
// Faulty Load
mov $0x3cde040000000b4f, %r8
and %r14, %r14
mov (%r8), %dx
lea oracles, %rbp
and $0xff, %rdx
shlq $12, %rdx
mov (%rbp,%rdx,1), %rdx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r8
pop %r14
pop %r13
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 3, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'AVXalign': True, 'congruent': 0, 'size': 1, 'same': True, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_NC', 'congruent': 0, 'same': True}, 'dst': {'type': 'addresses_D', 'congruent': 2, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 10, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 2, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 9, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 5, 'same': True}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 7, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 7, 'size': 2, 'same': False, 'NT': False}}
{'00': 1}
00
*/
| 19.85443 | 146 | 0.643927 | [
"MIT"
] | danielmgmi/medusa | Transynther/_processed/NC/_zr_/i7-7700_9_0x48.log_1_542.asm | 3,137 | Assembly |
STACK SEGMENT STACK
DW 64 DUP(?)
STACK ENDS
CODE SEGMENT
ASSUME CS:CODE,SS:STACK
START: PUSH DS
MOV AX,0
PUSH AX
MOV AH,0FH
INT 10H
MOV AH,0
MOV AL,3
INT 10H
MOV CX,1
MOV DX,0
LOP: MOV AH,2
INT 10H
MOV AL,40H
MOV AH,0AH
INT 10H
INC DH
INC DL
CMP DH,19
JNE LOP
RET
CODE ENDS
END START
| 23.571429 | 36 | 0.316667 | [
"MIT"
] | AlPhaSenkI/review_the_national_post-graduate_entrance_examination | books_and_notes/professional_courses/Assembly_language_and_programming/sources/汇编语言程序设计教程第四版/codes/9_12.asm | 660 | Assembly |
_kill: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
#include "stat.h"
#include "user.h"
int
main(int argc, char **argv)
{
0: 8d 4c 24 04 lea 0x4(%esp),%ecx
4: 83 e4 f0 and $0xfffffff0,%esp
7: ff 71 fc pushl -0x4(%ecx)
a: 55 push %ebp
b: 89 e5 mov %esp,%ebp
d: 57 push %edi
e: 56 push %esi
f: 53 push %ebx
10: 51 push %ecx
11: bb 01 00 00 00 mov $0x1,%ebx
16: 83 ec 08 sub $0x8,%esp
19: 8b 31 mov (%ecx),%esi
1b: 8b 79 04 mov 0x4(%ecx),%edi
int i;
if(argc < 2){
1e: 83 fe 01 cmp $0x1,%esi
21: 7e 27 jle 4a <main+0x4a>
23: 90 nop
24: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
printf(2, "usage: kill pid...\n");
exit();
}
for(i=1; i<argc; i++)
kill(atoi(argv[i]));
28: 83 ec 0c sub $0xc,%esp
2b: ff 34 9f pushl (%edi,%ebx,4)
if(argc < 2){
printf(2, "usage: kill pid...\n");
exit();
}
for(i=1; i<argc; i++)
2e: 83 c3 01 add $0x1,%ebx
kill(atoi(argv[i]));
31: e8 fa 01 00 00 call 230 <atoi>
36: 89 04 24 mov %eax,(%esp)
39: e8 94 02 00 00 call 2d2 <kill>
if(argc < 2){
printf(2, "usage: kill pid...\n");
exit();
}
for(i=1; i<argc; i++)
3e: 83 c4 10 add $0x10,%esp
41: 39 de cmp %ebx,%esi
43: 75 e3 jne 28 <main+0x28>
kill(atoi(argv[i]));
exit();
45: e8 58 02 00 00 call 2a2 <exit>
main(int argc, char **argv)
{
int i;
if(argc < 2){
printf(2, "usage: kill pid...\n");
4a: 50 push %eax
4b: 50 push %eax
4c: 68 30 07 00 00 push $0x730
51: 6a 02 push $0x2
53: e8 b8 03 00 00 call 410 <printf>
exit();
58: e8 45 02 00 00 call 2a2 <exit>
5d: 66 90 xchg %ax,%ax
5f: 90 nop
00000060 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, const char *t)
{
60: 55 push %ebp
61: 89 e5 mov %esp,%ebp
63: 53 push %ebx
64: 8b 45 08 mov 0x8(%ebp),%eax
67: 8b 4d 0c mov 0xc(%ebp),%ecx
char *os;
os = s;
while((*s++ = *t++) != 0)
6a: 89 c2 mov %eax,%edx
6c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
70: 83 c1 01 add $0x1,%ecx
73: 0f b6 59 ff movzbl -0x1(%ecx),%ebx
77: 83 c2 01 add $0x1,%edx
7a: 84 db test %bl,%bl
7c: 88 5a ff mov %bl,-0x1(%edx)
7f: 75 ef jne 70 <strcpy+0x10>
;
return os;
}
81: 5b pop %ebx
82: 5d pop %ebp
83: c3 ret
84: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
8a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
00000090 <strcmp>:
int
strcmp(const char *p, const char *q)
{
90: 55 push %ebp
91: 89 e5 mov %esp,%ebp
93: 56 push %esi
94: 53 push %ebx
95: 8b 55 08 mov 0x8(%ebp),%edx
98: 8b 4d 0c mov 0xc(%ebp),%ecx
while(*p && *p == *q)
9b: 0f b6 02 movzbl (%edx),%eax
9e: 0f b6 19 movzbl (%ecx),%ebx
a1: 84 c0 test %al,%al
a3: 75 1e jne c3 <strcmp+0x33>
a5: eb 29 jmp d0 <strcmp+0x40>
a7: 89 f6 mov %esi,%esi
a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
p++, q++;
b0: 83 c2 01 add $0x1,%edx
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
b3: 0f b6 02 movzbl (%edx),%eax
p++, q++;
b6: 8d 71 01 lea 0x1(%ecx),%esi
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
b9: 0f b6 59 01 movzbl 0x1(%ecx),%ebx
bd: 84 c0 test %al,%al
bf: 74 0f je d0 <strcmp+0x40>
c1: 89 f1 mov %esi,%ecx
c3: 38 d8 cmp %bl,%al
c5: 74 e9 je b0 <strcmp+0x20>
p++, q++;
return (uchar)*p - (uchar)*q;
c7: 29 d8 sub %ebx,%eax
}
c9: 5b pop %ebx
ca: 5e pop %esi
cb: 5d pop %ebp
cc: c3 ret
cd: 8d 76 00 lea 0x0(%esi),%esi
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
d0: 31 c0 xor %eax,%eax
p++, q++;
return (uchar)*p - (uchar)*q;
d2: 29 d8 sub %ebx,%eax
}
d4: 5b pop %ebx
d5: 5e pop %esi
d6: 5d pop %ebp
d7: c3 ret
d8: 90 nop
d9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
000000e0 <strlen>:
uint
strlen(const char *s)
{
e0: 55 push %ebp
e1: 89 e5 mov %esp,%ebp
e3: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
for(n = 0; s[n]; n++)
e6: 80 39 00 cmpb $0x0,(%ecx)
e9: 74 12 je fd <strlen+0x1d>
eb: 31 d2 xor %edx,%edx
ed: 8d 76 00 lea 0x0(%esi),%esi
f0: 83 c2 01 add $0x1,%edx
f3: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1)
f7: 89 d0 mov %edx,%eax
f9: 75 f5 jne f0 <strlen+0x10>
;
return n;
}
fb: 5d pop %ebp
fc: c3 ret
uint
strlen(const char *s)
{
int n;
for(n = 0; s[n]; n++)
fd: 31 c0 xor %eax,%eax
;
return n;
}
ff: 5d pop %ebp
100: c3 ret
101: eb 0d jmp 110 <memset>
103: 90 nop
104: 90 nop
105: 90 nop
106: 90 nop
107: 90 nop
108: 90 nop
109: 90 nop
10a: 90 nop
10b: 90 nop
10c: 90 nop
10d: 90 nop
10e: 90 nop
10f: 90 nop
00000110 <memset>:
void*
memset(void *dst, int c, uint n)
{
110: 55 push %ebp
111: 89 e5 mov %esp,%ebp
113: 57 push %edi
114: 8b 55 08 mov 0x8(%ebp),%edx
}
static inline void
stosb(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosb" :
117: 8b 4d 10 mov 0x10(%ebp),%ecx
11a: 8b 45 0c mov 0xc(%ebp),%eax
11d: 89 d7 mov %edx,%edi
11f: fc cld
120: f3 aa rep stos %al,%es:(%edi)
stosb(dst, c, n);
return dst;
}
122: 89 d0 mov %edx,%eax
124: 5f pop %edi
125: 5d pop %ebp
126: c3 ret
127: 89 f6 mov %esi,%esi
129: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000130 <strchr>:
char*
strchr(const char *s, char c)
{
130: 55 push %ebp
131: 89 e5 mov %esp,%ebp
133: 53 push %ebx
134: 8b 45 08 mov 0x8(%ebp),%eax
137: 8b 5d 0c mov 0xc(%ebp),%ebx
for(; *s; s++)
13a: 0f b6 10 movzbl (%eax),%edx
13d: 84 d2 test %dl,%dl
13f: 74 1d je 15e <strchr+0x2e>
if(*s == c)
141: 38 d3 cmp %dl,%bl
143: 89 d9 mov %ebx,%ecx
145: 75 0d jne 154 <strchr+0x24>
147: eb 17 jmp 160 <strchr+0x30>
149: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
150: 38 ca cmp %cl,%dl
152: 74 0c je 160 <strchr+0x30>
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
154: 83 c0 01 add $0x1,%eax
157: 0f b6 10 movzbl (%eax),%edx
15a: 84 d2 test %dl,%dl
15c: 75 f2 jne 150 <strchr+0x20>
if(*s == c)
return (char*)s;
return 0;
15e: 31 c0 xor %eax,%eax
}
160: 5b pop %ebx
161: 5d pop %ebp
162: c3 ret
163: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
169: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000170 <gets>:
char*
gets(char *buf, int max)
{
170: 55 push %ebp
171: 89 e5 mov %esp,%ebp
173: 57 push %edi
174: 56 push %esi
175: 53 push %ebx
int i, cc;
char c;
for(i=0; i+1 < max; ){
176: 31 f6 xor %esi,%esi
cc = read(0, &c, 1);
178: 8d 7d e7 lea -0x19(%ebp),%edi
return 0;
}
char*
gets(char *buf, int max)
{
17b: 83 ec 1c sub $0x1c,%esp
int i, cc;
char c;
for(i=0; i+1 < max; ){
17e: eb 29 jmp 1a9 <gets+0x39>
cc = read(0, &c, 1);
180: 83 ec 04 sub $0x4,%esp
183: 6a 01 push $0x1
185: 57 push %edi
186: 6a 00 push $0x0
188: e8 2d 01 00 00 call 2ba <read>
if(cc < 1)
18d: 83 c4 10 add $0x10,%esp
190: 85 c0 test %eax,%eax
192: 7e 1d jle 1b1 <gets+0x41>
break;
buf[i++] = c;
194: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
198: 8b 55 08 mov 0x8(%ebp),%edx
19b: 89 de mov %ebx,%esi
if(c == '\n' || c == '\r')
19d: 3c 0a cmp $0xa,%al
for(i=0; i+1 < max; ){
cc = read(0, &c, 1);
if(cc < 1)
break;
buf[i++] = c;
19f: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1)
if(c == '\n' || c == '\r')
1a3: 74 1b je 1c0 <gets+0x50>
1a5: 3c 0d cmp $0xd,%al
1a7: 74 17 je 1c0 <gets+0x50>
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
1a9: 8d 5e 01 lea 0x1(%esi),%ebx
1ac: 3b 5d 0c cmp 0xc(%ebp),%ebx
1af: 7c cf jl 180 <gets+0x10>
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
1b1: 8b 45 08 mov 0x8(%ebp),%eax
1b4: c6 04 30 00 movb $0x0,(%eax,%esi,1)
return buf;
}
1b8: 8d 65 f4 lea -0xc(%ebp),%esp
1bb: 5b pop %ebx
1bc: 5e pop %esi
1bd: 5f pop %edi
1be: 5d pop %ebp
1bf: c3 ret
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
1c0: 8b 45 08 mov 0x8(%ebp),%eax
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
1c3: 89 de mov %ebx,%esi
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
1c5: c6 04 30 00 movb $0x0,(%eax,%esi,1)
return buf;
}
1c9: 8d 65 f4 lea -0xc(%ebp),%esp
1cc: 5b pop %ebx
1cd: 5e pop %esi
1ce: 5f pop %edi
1cf: 5d pop %ebp
1d0: c3 ret
1d1: eb 0d jmp 1e0 <stat>
1d3: 90 nop
1d4: 90 nop
1d5: 90 nop
1d6: 90 nop
1d7: 90 nop
1d8: 90 nop
1d9: 90 nop
1da: 90 nop
1db: 90 nop
1dc: 90 nop
1dd: 90 nop
1de: 90 nop
1df: 90 nop
000001e0 <stat>:
int
stat(const char *n, struct stat *st)
{
1e0: 55 push %ebp
1e1: 89 e5 mov %esp,%ebp
1e3: 56 push %esi
1e4: 53 push %ebx
int fd;
int r;
fd = open(n, O_RDONLY);
1e5: 83 ec 08 sub $0x8,%esp
1e8: 6a 00 push $0x0
1ea: ff 75 08 pushl 0x8(%ebp)
1ed: e8 f0 00 00 00 call 2e2 <open>
if(fd < 0)
1f2: 83 c4 10 add $0x10,%esp
1f5: 85 c0 test %eax,%eax
1f7: 78 27 js 220 <stat+0x40>
return -1;
r = fstat(fd, st);
1f9: 83 ec 08 sub $0x8,%esp
1fc: ff 75 0c pushl 0xc(%ebp)
1ff: 89 c3 mov %eax,%ebx
201: 50 push %eax
202: e8 f3 00 00 00 call 2fa <fstat>
207: 89 c6 mov %eax,%esi
close(fd);
209: 89 1c 24 mov %ebx,(%esp)
20c: e8 b9 00 00 00 call 2ca <close>
return r;
211: 83 c4 10 add $0x10,%esp
214: 89 f0 mov %esi,%eax
}
216: 8d 65 f8 lea -0x8(%ebp),%esp
219: 5b pop %ebx
21a: 5e pop %esi
21b: 5d pop %ebp
21c: c3 ret
21d: 8d 76 00 lea 0x0(%esi),%esi
int fd;
int r;
fd = open(n, O_RDONLY);
if(fd < 0)
return -1;
220: b8 ff ff ff ff mov $0xffffffff,%eax
225: eb ef jmp 216 <stat+0x36>
227: 89 f6 mov %esi,%esi
229: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000230 <atoi>:
return r;
}
int
atoi(const char *s)
{
230: 55 push %ebp
231: 89 e5 mov %esp,%ebp
233: 53 push %ebx
234: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
n = 0;
while('0' <= *s && *s <= '9')
237: 0f be 11 movsbl (%ecx),%edx
23a: 8d 42 d0 lea -0x30(%edx),%eax
23d: 3c 09 cmp $0x9,%al
23f: b8 00 00 00 00 mov $0x0,%eax
244: 77 1f ja 265 <atoi+0x35>
246: 8d 76 00 lea 0x0(%esi),%esi
249: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
n = n*10 + *s++ - '0';
250: 8d 04 80 lea (%eax,%eax,4),%eax
253: 83 c1 01 add $0x1,%ecx
256: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax
atoi(const char *s)
{
int n;
n = 0;
while('0' <= *s && *s <= '9')
25a: 0f be 11 movsbl (%ecx),%edx
25d: 8d 5a d0 lea -0x30(%edx),%ebx
260: 80 fb 09 cmp $0x9,%bl
263: 76 eb jbe 250 <atoi+0x20>
n = n*10 + *s++ - '0';
return n;
}
265: 5b pop %ebx
266: 5d pop %ebp
267: c3 ret
268: 90 nop
269: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000270 <memmove>:
void*
memmove(void *vdst, const void *vsrc, int n)
{
270: 55 push %ebp
271: 89 e5 mov %esp,%ebp
273: 56 push %esi
274: 53 push %ebx
275: 8b 5d 10 mov 0x10(%ebp),%ebx
278: 8b 45 08 mov 0x8(%ebp),%eax
27b: 8b 75 0c mov 0xc(%ebp),%esi
char *dst;
const char *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
27e: 85 db test %ebx,%ebx
280: 7e 14 jle 296 <memmove+0x26>
282: 31 d2 xor %edx,%edx
284: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
*dst++ = *src++;
288: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx
28c: 88 0c 10 mov %cl,(%eax,%edx,1)
28f: 83 c2 01 add $0x1,%edx
char *dst;
const char *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
292: 39 da cmp %ebx,%edx
294: 75 f2 jne 288 <memmove+0x18>
*dst++ = *src++;
return vdst;
}
296: 5b pop %ebx
297: 5e pop %esi
298: 5d pop %ebp
299: c3 ret
0000029a <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
29a: b8 01 00 00 00 mov $0x1,%eax
29f: cd 40 int $0x40
2a1: c3 ret
000002a2 <exit>:
SYSCALL(exit)
2a2: b8 02 00 00 00 mov $0x2,%eax
2a7: cd 40 int $0x40
2a9: c3 ret
000002aa <wait>:
SYSCALL(wait)
2aa: b8 03 00 00 00 mov $0x3,%eax
2af: cd 40 int $0x40
2b1: c3 ret
000002b2 <pipe>:
SYSCALL(pipe)
2b2: b8 04 00 00 00 mov $0x4,%eax
2b7: cd 40 int $0x40
2b9: c3 ret
000002ba <read>:
SYSCALL(read)
2ba: b8 05 00 00 00 mov $0x5,%eax
2bf: cd 40 int $0x40
2c1: c3 ret
000002c2 <write>:
SYSCALL(write)
2c2: b8 10 00 00 00 mov $0x10,%eax
2c7: cd 40 int $0x40
2c9: c3 ret
000002ca <close>:
SYSCALL(close)
2ca: b8 15 00 00 00 mov $0x15,%eax
2cf: cd 40 int $0x40
2d1: c3 ret
000002d2 <kill>:
SYSCALL(kill)
2d2: b8 06 00 00 00 mov $0x6,%eax
2d7: cd 40 int $0x40
2d9: c3 ret
000002da <exec>:
SYSCALL(exec)
2da: b8 07 00 00 00 mov $0x7,%eax
2df: cd 40 int $0x40
2e1: c3 ret
000002e2 <open>:
SYSCALL(open)
2e2: b8 0f 00 00 00 mov $0xf,%eax
2e7: cd 40 int $0x40
2e9: c3 ret
000002ea <mknod>:
SYSCALL(mknod)
2ea: b8 11 00 00 00 mov $0x11,%eax
2ef: cd 40 int $0x40
2f1: c3 ret
000002f2 <unlink>:
SYSCALL(unlink)
2f2: b8 12 00 00 00 mov $0x12,%eax
2f7: cd 40 int $0x40
2f9: c3 ret
000002fa <fstat>:
SYSCALL(fstat)
2fa: b8 08 00 00 00 mov $0x8,%eax
2ff: cd 40 int $0x40
301: c3 ret
00000302 <link>:
SYSCALL(link)
302: b8 13 00 00 00 mov $0x13,%eax
307: cd 40 int $0x40
309: c3 ret
0000030a <mkdir>:
SYSCALL(mkdir)
30a: b8 14 00 00 00 mov $0x14,%eax
30f: cd 40 int $0x40
311: c3 ret
00000312 <chdir>:
SYSCALL(chdir)
312: b8 09 00 00 00 mov $0x9,%eax
317: cd 40 int $0x40
319: c3 ret
0000031a <dup>:
SYSCALL(dup)
31a: b8 0a 00 00 00 mov $0xa,%eax
31f: cd 40 int $0x40
321: c3 ret
00000322 <getpid>:
SYSCALL(getpid)
322: b8 0b 00 00 00 mov $0xb,%eax
327: cd 40 int $0x40
329: c3 ret
0000032a <sbrk>:
SYSCALL(sbrk)
32a: b8 0c 00 00 00 mov $0xc,%eax
32f: cd 40 int $0x40
331: c3 ret
00000332 <sleep>:
SYSCALL(sleep)
332: b8 0d 00 00 00 mov $0xd,%eax
337: cd 40 int $0x40
339: c3 ret
0000033a <uptime>:
SYSCALL(uptime)
33a: b8 0e 00 00 00 mov $0xe,%eax
33f: cd 40 int $0x40
341: c3 ret
00000342 <waitx>:
SYSCALL(waitx)
342: b8 16 00 00 00 mov $0x16,%eax
347: cd 40 int $0x40
349: c3 ret
0000034a <cps>:
SYSCALL(cps)
34a: b8 17 00 00 00 mov $0x17,%eax
34f: cd 40 int $0x40
351: c3 ret
00000352 <set_priority>:
SYSCALL(set_priority)
352: b8 18 00 00 00 mov $0x18,%eax
357: cd 40 int $0x40
359: c3 ret
0000035a <getpinfo>:
35a: b8 19 00 00 00 mov $0x19,%eax
35f: cd 40 int $0x40
361: c3 ret
362: 66 90 xchg %ax,%ax
364: 66 90 xchg %ax,%ax
366: 66 90 xchg %ax,%ax
368: 66 90 xchg %ax,%ax
36a: 66 90 xchg %ax,%ax
36c: 66 90 xchg %ax,%ax
36e: 66 90 xchg %ax,%ax
00000370 <printint>:
write(fd, &c, 1);
}
static void
printint(int fd, int xx, int base, int sgn)
{
370: 55 push %ebp
371: 89 e5 mov %esp,%ebp
373: 57 push %edi
374: 56 push %esi
375: 53 push %ebx
376: 89 c6 mov %eax,%esi
378: 83 ec 3c sub $0x3c,%esp
char buf[16];
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
37b: 8b 5d 08 mov 0x8(%ebp),%ebx
37e: 85 db test %ebx,%ebx
380: 74 7e je 400 <printint+0x90>
382: 89 d0 mov %edx,%eax
384: c1 e8 1f shr $0x1f,%eax
387: 84 c0 test %al,%al
389: 74 75 je 400 <printint+0x90>
neg = 1;
x = -xx;
38b: 89 d0 mov %edx,%eax
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
neg = 1;
38d: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp)
x = -xx;
394: f7 d8 neg %eax
396: 89 75 c0 mov %esi,-0x40(%ebp)
} else {
x = xx;
}
i = 0;
399: 31 ff xor %edi,%edi
39b: 8d 5d d7 lea -0x29(%ebp),%ebx
39e: 89 ce mov %ecx,%esi
3a0: eb 08 jmp 3aa <printint+0x3a>
3a2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
do{
buf[i++] = digits[x % base];
3a8: 89 cf mov %ecx,%edi
3aa: 31 d2 xor %edx,%edx
3ac: 8d 4f 01 lea 0x1(%edi),%ecx
3af: f7 f6 div %esi
3b1: 0f b6 92 4c 07 00 00 movzbl 0x74c(%edx),%edx
}while((x /= base) != 0);
3b8: 85 c0 test %eax,%eax
x = xx;
}
i = 0;
do{
buf[i++] = digits[x % base];
3ba: 88 14 0b mov %dl,(%ebx,%ecx,1)
}while((x /= base) != 0);
3bd: 75 e9 jne 3a8 <printint+0x38>
if(neg)
3bf: 8b 45 c4 mov -0x3c(%ebp),%eax
3c2: 8b 75 c0 mov -0x40(%ebp),%esi
3c5: 85 c0 test %eax,%eax
3c7: 74 08 je 3d1 <printint+0x61>
buf[i++] = '-';
3c9: c6 44 0d d8 2d movb $0x2d,-0x28(%ebp,%ecx,1)
3ce: 8d 4f 02 lea 0x2(%edi),%ecx
3d1: 8d 7c 0d d7 lea -0x29(%ebp,%ecx,1),%edi
3d5: 8d 76 00 lea 0x0(%esi),%esi
3d8: 0f b6 07 movzbl (%edi),%eax
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
3db: 83 ec 04 sub $0x4,%esp
3de: 83 ef 01 sub $0x1,%edi
3e1: 6a 01 push $0x1
3e3: 53 push %ebx
3e4: 56 push %esi
3e5: 88 45 d7 mov %al,-0x29(%ebp)
3e8: e8 d5 fe ff ff call 2c2 <write>
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
3ed: 83 c4 10 add $0x10,%esp
3f0: 39 df cmp %ebx,%edi
3f2: 75 e4 jne 3d8 <printint+0x68>
putc(fd, buf[i]);
}
3f4: 8d 65 f4 lea -0xc(%ebp),%esp
3f7: 5b pop %ebx
3f8: 5e pop %esi
3f9: 5f pop %edi
3fa: 5d pop %ebp
3fb: c3 ret
3fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
neg = 0;
if(sgn && xx < 0){
neg = 1;
x = -xx;
} else {
x = xx;
400: 89 d0 mov %edx,%eax
static char digits[] = "0123456789ABCDEF";
char buf[16];
int i, neg;
uint x;
neg = 0;
402: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp)
409: eb 8b jmp 396 <printint+0x26>
40b: 90 nop
40c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00000410 <printf>:
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, const char *fmt, ...)
{
410: 55 push %ebp
411: 89 e5 mov %esp,%ebp
413: 57 push %edi
414: 56 push %esi
415: 53 push %ebx
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
416: 8d 45 10 lea 0x10(%ebp),%eax
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, const char *fmt, ...)
{
419: 83 ec 2c sub $0x2c,%esp
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
41c: 8b 75 0c mov 0xc(%ebp),%esi
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, const char *fmt, ...)
{
41f: 8b 7d 08 mov 0x8(%ebp),%edi
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
422: 89 45 d0 mov %eax,-0x30(%ebp)
425: 0f b6 1e movzbl (%esi),%ebx
428: 83 c6 01 add $0x1,%esi
42b: 84 db test %bl,%bl
42d: 0f 84 b0 00 00 00 je 4e3 <printf+0xd3>
433: 31 d2 xor %edx,%edx
435: eb 39 jmp 470 <printf+0x60>
437: 89 f6 mov %esi,%esi
439: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
440: 83 f8 25 cmp $0x25,%eax
443: 89 55 d4 mov %edx,-0x2c(%ebp)
state = '%';
446: ba 25 00 00 00 mov $0x25,%edx
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
44b: 74 18 je 465 <printf+0x55>
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
44d: 8d 45 e2 lea -0x1e(%ebp),%eax
450: 83 ec 04 sub $0x4,%esp
453: 88 5d e2 mov %bl,-0x1e(%ebp)
456: 6a 01 push $0x1
458: 50 push %eax
459: 57 push %edi
45a: e8 63 fe ff ff call 2c2 <write>
45f: 8b 55 d4 mov -0x2c(%ebp),%edx
462: 83 c4 10 add $0x10,%esp
465: 83 c6 01 add $0x1,%esi
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
468: 0f b6 5e ff movzbl -0x1(%esi),%ebx
46c: 84 db test %bl,%bl
46e: 74 73 je 4e3 <printf+0xd3>
c = fmt[i] & 0xff;
if(state == 0){
470: 85 d2 test %edx,%edx
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
c = fmt[i] & 0xff;
472: 0f be cb movsbl %bl,%ecx
475: 0f b6 c3 movzbl %bl,%eax
if(state == 0){
478: 74 c6 je 440 <printf+0x30>
if(c == '%'){
state = '%';
} else {
putc(fd, c);
}
} else if(state == '%'){
47a: 83 fa 25 cmp $0x25,%edx
47d: 75 e6 jne 465 <printf+0x55>
if(c == 'd'){
47f: 83 f8 64 cmp $0x64,%eax
482: 0f 84 f8 00 00 00 je 580 <printf+0x170>
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
488: 81 e1 f7 00 00 00 and $0xf7,%ecx
48e: 83 f9 70 cmp $0x70,%ecx
491: 74 5d je 4f0 <printf+0xe0>
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
493: 83 f8 73 cmp $0x73,%eax
496: 0f 84 84 00 00 00 je 520 <printf+0x110>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
49c: 83 f8 63 cmp $0x63,%eax
49f: 0f 84 ea 00 00 00 je 58f <printf+0x17f>
putc(fd, *ap);
ap++;
} else if(c == '%'){
4a5: 83 f8 25 cmp $0x25,%eax
4a8: 0f 84 c2 00 00 00 je 570 <printf+0x160>
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
4ae: 8d 45 e7 lea -0x19(%ebp),%eax
4b1: 83 ec 04 sub $0x4,%esp
4b4: c6 45 e7 25 movb $0x25,-0x19(%ebp)
4b8: 6a 01 push $0x1
4ba: 50 push %eax
4bb: 57 push %edi
4bc: e8 01 fe ff ff call 2c2 <write>
4c1: 83 c4 0c add $0xc,%esp
4c4: 8d 45 e6 lea -0x1a(%ebp),%eax
4c7: 88 5d e6 mov %bl,-0x1a(%ebp)
4ca: 6a 01 push $0x1
4cc: 50 push %eax
4cd: 57 push %edi
4ce: 83 c6 01 add $0x1,%esi
4d1: e8 ec fd ff ff call 2c2 <write>
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
4d6: 0f b6 5e ff movzbl -0x1(%esi),%ebx
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
4da: 83 c4 10 add $0x10,%esp
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
4dd: 31 d2 xor %edx,%edx
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
4df: 84 db test %bl,%bl
4e1: 75 8d jne 470 <printf+0x60>
putc(fd, c);
}
state = 0;
}
}
}
4e3: 8d 65 f4 lea -0xc(%ebp),%esp
4e6: 5b pop %ebx
4e7: 5e pop %esi
4e8: 5f pop %edi
4e9: 5d pop %ebp
4ea: c3 ret
4eb: 90 nop
4ec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
} else if(state == '%'){
if(c == 'd'){
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
printint(fd, *ap, 16, 0);
4f0: 83 ec 0c sub $0xc,%esp
4f3: b9 10 00 00 00 mov $0x10,%ecx
4f8: 6a 00 push $0x0
4fa: 8b 5d d0 mov -0x30(%ebp),%ebx
4fd: 89 f8 mov %edi,%eax
4ff: 8b 13 mov (%ebx),%edx
501: e8 6a fe ff ff call 370 <printint>
ap++;
506: 89 d8 mov %ebx,%eax
508: 83 c4 10 add $0x10,%esp
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
50b: 31 d2 xor %edx,%edx
if(c == 'd'){
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
printint(fd, *ap, 16, 0);
ap++;
50d: 83 c0 04 add $0x4,%eax
510: 89 45 d0 mov %eax,-0x30(%ebp)
513: e9 4d ff ff ff jmp 465 <printf+0x55>
518: 90 nop
519: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
} else if(c == 's'){
s = (char*)*ap;
520: 8b 45 d0 mov -0x30(%ebp),%eax
523: 8b 18 mov (%eax),%ebx
ap++;
525: 83 c0 04 add $0x4,%eax
528: 89 45 d0 mov %eax,-0x30(%ebp)
if(s == 0)
s = "(null)";
52b: b8 44 07 00 00 mov $0x744,%eax
530: 85 db test %ebx,%ebx
532: 0f 44 d8 cmove %eax,%ebx
while(*s != 0){
535: 0f b6 03 movzbl (%ebx),%eax
538: 84 c0 test %al,%al
53a: 74 23 je 55f <printf+0x14f>
53c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
540: 88 45 e3 mov %al,-0x1d(%ebp)
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
543: 8d 45 e3 lea -0x1d(%ebp),%eax
546: 83 ec 04 sub $0x4,%esp
549: 6a 01 push $0x1
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
54b: 83 c3 01 add $0x1,%ebx
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
54e: 50 push %eax
54f: 57 push %edi
550: e8 6d fd ff ff call 2c2 <write>
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
555: 0f b6 03 movzbl (%ebx),%eax
558: 83 c4 10 add $0x10,%esp
55b: 84 c0 test %al,%al
55d: 75 e1 jne 540 <printf+0x130>
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
55f: 31 d2 xor %edx,%edx
561: e9 ff fe ff ff jmp 465 <printf+0x55>
566: 8d 76 00 lea 0x0(%esi),%esi
569: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
570: 83 ec 04 sub $0x4,%esp
573: 88 5d e5 mov %bl,-0x1b(%ebp)
576: 8d 45 e5 lea -0x1b(%ebp),%eax
579: 6a 01 push $0x1
57b: e9 4c ff ff ff jmp 4cc <printf+0xbc>
} else {
putc(fd, c);
}
} else if(state == '%'){
if(c == 'd'){
printint(fd, *ap, 10, 1);
580: 83 ec 0c sub $0xc,%esp
583: b9 0a 00 00 00 mov $0xa,%ecx
588: 6a 01 push $0x1
58a: e9 6b ff ff ff jmp 4fa <printf+0xea>
58f: 8b 5d d0 mov -0x30(%ebp),%ebx
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
592: 83 ec 04 sub $0x4,%esp
595: 8b 03 mov (%ebx),%eax
597: 6a 01 push $0x1
599: 88 45 e4 mov %al,-0x1c(%ebp)
59c: 8d 45 e4 lea -0x1c(%ebp),%eax
59f: 50 push %eax
5a0: 57 push %edi
5a1: e8 1c fd ff ff call 2c2 <write>
5a6: e9 5b ff ff ff jmp 506 <printf+0xf6>
5ab: 66 90 xchg %ax,%ax
5ad: 66 90 xchg %ax,%ax
5af: 90 nop
000005b0 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
5b0: 55 push %ebp
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
5b1: a1 f0 09 00 00 mov 0x9f0,%eax
static Header base;
static Header *freep;
void
free(void *ap)
{
5b6: 89 e5 mov %esp,%ebp
5b8: 57 push %edi
5b9: 56 push %esi
5ba: 53 push %ebx
5bb: 8b 5d 08 mov 0x8(%ebp),%ebx
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
5be: 8b 10 mov (%eax),%edx
void
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
5c0: 8d 4b f8 lea -0x8(%ebx),%ecx
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
5c3: 39 c8 cmp %ecx,%eax
5c5: 73 19 jae 5e0 <free+0x30>
5c7: 89 f6 mov %esi,%esi
5c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
5d0: 39 d1 cmp %edx,%ecx
5d2: 72 1c jb 5f0 <free+0x40>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
5d4: 39 d0 cmp %edx,%eax
5d6: 73 18 jae 5f0 <free+0x40>
static Header base;
static Header *freep;
void
free(void *ap)
{
5d8: 89 d0 mov %edx,%eax
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
5da: 39 c8 cmp %ecx,%eax
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
5dc: 8b 10 mov (%eax),%edx
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
5de: 72 f0 jb 5d0 <free+0x20>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
5e0: 39 d0 cmp %edx,%eax
5e2: 72 f4 jb 5d8 <free+0x28>
5e4: 39 d1 cmp %edx,%ecx
5e6: 73 f0 jae 5d8 <free+0x28>
5e8: 90 nop
5e9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
break;
if(bp + bp->s.size == p->s.ptr){
5f0: 8b 73 fc mov -0x4(%ebx),%esi
5f3: 8d 3c f1 lea (%ecx,%esi,8),%edi
5f6: 39 d7 cmp %edx,%edi
5f8: 74 19 je 613 <free+0x63>
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
} else
bp->s.ptr = p->s.ptr;
5fa: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
5fd: 8b 50 04 mov 0x4(%eax),%edx
600: 8d 34 d0 lea (%eax,%edx,8),%esi
603: 39 f1 cmp %esi,%ecx
605: 74 23 je 62a <free+0x7a>
p->s.size += bp->s.size;
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
607: 89 08 mov %ecx,(%eax)
freep = p;
609: a3 f0 09 00 00 mov %eax,0x9f0
}
60e: 5b pop %ebx
60f: 5e pop %esi
610: 5f pop %edi
611: 5d pop %ebp
612: c3 ret
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
break;
if(bp + bp->s.size == p->s.ptr){
bp->s.size += p->s.ptr->s.size;
613: 03 72 04 add 0x4(%edx),%esi
616: 89 73 fc mov %esi,-0x4(%ebx)
bp->s.ptr = p->s.ptr->s.ptr;
619: 8b 10 mov (%eax),%edx
61b: 8b 12 mov (%edx),%edx
61d: 89 53 f8 mov %edx,-0x8(%ebx)
} else
bp->s.ptr = p->s.ptr;
if(p + p->s.size == bp){
620: 8b 50 04 mov 0x4(%eax),%edx
623: 8d 34 d0 lea (%eax,%edx,8),%esi
626: 39 f1 cmp %esi,%ecx
628: 75 dd jne 607 <free+0x57>
p->s.size += bp->s.size;
62a: 03 53 fc add -0x4(%ebx),%edx
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
freep = p;
62d: a3 f0 09 00 00 mov %eax,0x9f0
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
} else
bp->s.ptr = p->s.ptr;
if(p + p->s.size == bp){
p->s.size += bp->s.size;
632: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
635: 8b 53 f8 mov -0x8(%ebx),%edx
638: 89 10 mov %edx,(%eax)
} else
p->s.ptr = bp;
freep = p;
}
63a: 5b pop %ebx
63b: 5e pop %esi
63c: 5f pop %edi
63d: 5d pop %ebp
63e: c3 ret
63f: 90 nop
00000640 <malloc>:
return freep;
}
void*
malloc(uint nbytes)
{
640: 55 push %ebp
641: 89 e5 mov %esp,%ebp
643: 57 push %edi
644: 56 push %esi
645: 53 push %ebx
646: 83 ec 0c sub $0xc,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
649: 8b 45 08 mov 0x8(%ebp),%eax
if((prevp = freep) == 0){
64c: 8b 15 f0 09 00 00 mov 0x9f0,%edx
malloc(uint nbytes)
{
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
652: 8d 78 07 lea 0x7(%eax),%edi
655: c1 ef 03 shr $0x3,%edi
658: 83 c7 01 add $0x1,%edi
if((prevp = freep) == 0){
65b: 85 d2 test %edx,%edx
65d: 0f 84 a3 00 00 00 je 706 <malloc+0xc6>
663: 8b 02 mov (%edx),%eax
665: 8b 48 04 mov 0x4(%eax),%ecx
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
if(p->s.size >= nunits){
668: 39 cf cmp %ecx,%edi
66a: 76 74 jbe 6e0 <malloc+0xa0>
66c: 81 ff 00 10 00 00 cmp $0x1000,%edi
672: be 00 10 00 00 mov $0x1000,%esi
677: 8d 1c fd 00 00 00 00 lea 0x0(,%edi,8),%ebx
67e: 0f 43 f7 cmovae %edi,%esi
681: ba 00 80 00 00 mov $0x8000,%edx
686: 81 ff ff 0f 00 00 cmp $0xfff,%edi
68c: 0f 46 da cmovbe %edx,%ebx
68f: eb 10 jmp 6a1 <malloc+0x61>
691: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
698: 8b 02 mov (%edx),%eax
if(p->s.size >= nunits){
69a: 8b 48 04 mov 0x4(%eax),%ecx
69d: 39 cf cmp %ecx,%edi
69f: 76 3f jbe 6e0 <malloc+0xa0>
p->s.size = nunits;
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
6a1: 39 05 f0 09 00 00 cmp %eax,0x9f0
6a7: 89 c2 mov %eax,%edx
6a9: 75 ed jne 698 <malloc+0x58>
char *p;
Header *hp;
if(nu < 4096)
nu = 4096;
p = sbrk(nu * sizeof(Header));
6ab: 83 ec 0c sub $0xc,%esp
6ae: 53 push %ebx
6af: e8 76 fc ff ff call 32a <sbrk>
if(p == (char*)-1)
6b4: 83 c4 10 add $0x10,%esp
6b7: 83 f8 ff cmp $0xffffffff,%eax
6ba: 74 1c je 6d8 <malloc+0x98>
return 0;
hp = (Header*)p;
hp->s.size = nu;
6bc: 89 70 04 mov %esi,0x4(%eax)
free((void*)(hp + 1));
6bf: 83 ec 0c sub $0xc,%esp
6c2: 83 c0 08 add $0x8,%eax
6c5: 50 push %eax
6c6: e8 e5 fe ff ff call 5b0 <free>
return freep;
6cb: 8b 15 f0 09 00 00 mov 0x9f0,%edx
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
if((p = morecore(nunits)) == 0)
6d1: 83 c4 10 add $0x10,%esp
6d4: 85 d2 test %edx,%edx
6d6: 75 c0 jne 698 <malloc+0x58>
return 0;
6d8: 31 c0 xor %eax,%eax
6da: eb 1c jmp 6f8 <malloc+0xb8>
6dc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
if(p->s.size >= nunits){
if(p->s.size == nunits)
6e0: 39 cf cmp %ecx,%edi
6e2: 74 1c je 700 <malloc+0xc0>
prevp->s.ptr = p->s.ptr;
else {
p->s.size -= nunits;
6e4: 29 f9 sub %edi,%ecx
6e6: 89 48 04 mov %ecx,0x4(%eax)
p += p->s.size;
6e9: 8d 04 c8 lea (%eax,%ecx,8),%eax
p->s.size = nunits;
6ec: 89 78 04 mov %edi,0x4(%eax)
}
freep = prevp;
6ef: 89 15 f0 09 00 00 mov %edx,0x9f0
return (void*)(p + 1);
6f5: 83 c0 08 add $0x8,%eax
}
if(p == freep)
if((p = morecore(nunits)) == 0)
return 0;
}
}
6f8: 8d 65 f4 lea -0xc(%ebp),%esp
6fb: 5b pop %ebx
6fc: 5e pop %esi
6fd: 5f pop %edi
6fe: 5d pop %ebp
6ff: c3 ret
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
if(p->s.size >= nunits){
if(p->s.size == nunits)
prevp->s.ptr = p->s.ptr;
700: 8b 08 mov (%eax),%ecx
702: 89 0a mov %ecx,(%edx)
704: eb e9 jmp 6ef <malloc+0xaf>
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
706: c7 05 f0 09 00 00 f4 movl $0x9f4,0x9f0
70d: 09 00 00
710: c7 05 f4 09 00 00 f4 movl $0x9f4,0x9f4
717: 09 00 00
base.s.size = 0;
71a: b8 f4 09 00 00 mov $0x9f4,%eax
71f: c7 05 f8 09 00 00 00 movl $0x0,0x9f8
726: 00 00 00
729: e9 3e ff ff ff jmp 66c <malloc+0x2c>
| 29.748192 | 60 | 0.411453 | [
"MIT-0"
] | harshika18/xv6-assignment | kill.asm | 45,247 | Assembly |
; Licensed to the .NET Foundation under one or more agreements.
; The .NET Foundation licenses this file to you under the MIT license.
;; ==++==
;;
;;
;; ==--==
#include "ksarm64.h"
#include "asmconstants.h"
IMPORT CallDescrWorkerUnwindFrameChainHandler
;;-----------------------------------------------------------------------------
;; This helper routine enregisters the appropriate arguments and makes the
;; actual call.
;;-----------------------------------------------------------------------------
;;void CallDescrWorkerInternal(CallDescrData * pCallDescrData);
NESTED_ENTRY CallDescrWorkerInternal,,CallDescrWorkerUnwindFrameChainHandler
PROLOG_SAVE_REG_PAIR fp, lr, #-32!
PROLOG_SAVE_REG x19, #16 ;the stack slot at sp+24 is empty for 16 byte alligment
mov x19, x0 ; save pCallDescrData in x19
ldr w1, [x19,#CallDescrData__numStackSlots]
cbz w1, Ldonestack
;; Add frame padding to ensure frame size is a multiple of 16 (a requirement of the OS ABI).
;; We push two registers (above) and numStackSlots arguments (below). If this comes to an odd number
;; of slots we must pad with another. This simplifies to "if the low bit of numStackSlots is set,
;; extend the stack another eight bytes".
ldr x0, [x19,#CallDescrData__pSrc]
add x0, x0, x1 lsl #3 ; pSrcEnd=pSrc+8*numStackSlots
ands x2, x1, #1
beq Lstackloop
;; This loop copies numStackSlots words
;; from [pSrcEnd-8,pSrcEnd-16,...] to [sp-8,sp-16,...]
;; pad and store one stack slot as number of slots are odd
ldr x4, [x0,#-8]!
str x4, [sp,#-16]!
subs x1, x1, #1
beq Ldonestack
Lstackloop
ldp x2, x4, [x0,#-16]!
stp x2, x4, [sp,#-16]!
subs x1, x1, #2
bne Lstackloop
Ldonestack
;; If FP arguments are supplied in registers (x9 != NULL) then initialize all of them from the pointer
;; given in x9.
ldr x9, [x19,#CallDescrData__pFloatArgumentRegisters]
cbz x9, LNoFloatingPoint
ldp q0, q1, [x9]
ldp q2, q3, [x9, #32]
ldp q4, q5, [x9, #64]
ldp q6, q7, [x9, #96]
LNoFloatingPoint
;; Copy [pArgumentRegisters, ..., pArgumentRegisters + 56]
;; into x0, ..., x7
ldr x9, [x19,#CallDescrData__pArgumentRegisters]
ldp x0, x1, [x9]
ldp x2, x3, [x9, #16]
ldp x4, x5, [x9, #32]
ldp x6, x7, [x9, #48]
;; Copy pRetBuffArg into x8
ldr x9, [x19,#CallDescrData__pRetBuffArg]
ldr x8, [x9]
;; call pTarget
ldr x9, [x19,#CallDescrData__pTarget]
blr x9
ldr w3, [x19,#CallDescrData__fpReturnSize]
;; Int return case
cbz w3, LIntReturn
;; Float return case
cmp w3, #4
beq LFloatReturn
;; Double return case
cmp w3, #8
bne LNoDoubleReturn
LFloatReturn
str q0, [x19, #(CallDescrData__returnValue + 0)]
b LReturnDone
LNoDoubleReturn
;;FloatHFAReturn return case
cmp w3, #16
bne LNoFloatHFAReturn
stp s0, s1, [x19, #(CallDescrData__returnValue + 0)]
stp s2, s3, [x19, #(CallDescrData__returnValue + 0x08)]
b LReturnDone
LNoFloatHFAReturn
;;DoubleHFAReturn return case
cmp w3, #32
bne LNoDoubleHFAReturn
stp d0, d1, [x19, #(CallDescrData__returnValue + 0)]
stp d2, d3, [x19, #(CallDescrData__returnValue + 0x10)]
b LReturnDone
LNoDoubleHFAReturn
;;VectorHFAReturn return case
cmp w3, #64
bne LNoVectorHFAReturn
stp q0, q1, [x19, #(CallDescrData__returnValue + 0)]
stp q2, q3, [x19, #(CallDescrData__returnValue + 0x20)]
b LReturnDone
LNoVectorHFAReturn
EMIT_BREAKPOINT ; Unreachable
LIntReturn
;; Save return value(s) into retbuf for int
stp x0,x1, [x19, #(CallDescrData__returnValue + 0)]
LReturnDone
#ifdef _DEBUG
;; trash the floating point registers to ensure that the HFA return values
;; won't survive by accident
ldp d0, d1, [sp]
ldp d2, d3, [sp, #16]
#endif
EPILOG_STACK_RESTORE
EPILOG_RESTORE_REG x19, #16 ;the stack slot at sp+24 is empty for 16 byte alligment
EPILOG_RESTORE_REG_PAIR fp, lr, #32!
EPILOG_RETURN
NESTED_END
END
| 30.960265 | 110 | 0.56 | [
"MIT"
] | 2m0nd/runtime | src/coreclr/src/vm/arm64/CallDescrWorkerARM64.asm | 4,675 | Assembly |
.size 8000
.text@48
jp lstatint
.text@100
jp lbegin
.data@143
c0
.text@150
lbegin:
ld a, 00
ldff(ff), a
ld a, 30
ldff(00), a
ld a, 01
ldff(4d), a
stop, 00
ld a, ff
ldff(45), a
ld b, 91
call lwaitly_b
ld hl, fe00
ld d, 10
ld a, d
ld(hl++), a
ld a, 08
ld(hl++), a
inc l
inc l
ld a, d
ld(hl++), a
ld(hl++), a
inc l
inc l
ld(hl++), a
ld a, 18
ld(hl++), a
inc l
inc l
ld a, d
ld(hl++), a
ld a, 20
ld(hl++), a
inc l
inc l
ld a, d
ld(hl++), a
ld a, 28
ld(hl++), a
inc l
inc l
ld a, d
ld(hl++), a
ld a, 30
ld(hl++), a
inc l
inc l
ld a, d
ld(hl++), a
ld a, 38
ld(hl++), a
inc l
inc l
ld a, d
ld(hl++), a
ld a, 40
ld(hl++), a
inc l
inc l
ld a, d
ld(hl++), a
ld a, 48
ld(hl++), a
inc l
inc l
ld a, d
ld(hl++), a
ld a, 4a
ld(hl++), a
ld a, 40
ldff(41), a
ld a, 02
ldff(ff), a
xor a, a
ldff(0f), a
ei
ld a, 01
ldff(45), a
ld c, 41
ld a, 93
ldff(40), a
.text@1000
lstatint:
nop
.text@10a8
ldff a, (c)
and a, 03
jp lprint_a
.text@7000
lprint_a:
push af
ld b, 91
call lwaitly_b
xor a, a
ldff(40), a
pop af
ld(9800), a
ld bc, 7a00
ld hl, 8000
ld d, a0
lprint_copytiles:
ld a, (bc)
inc bc
ld(hl++), a
dec d
jrnz lprint_copytiles
ld a, c0
ldff(47), a
ld a, 80
ldff(68), a
ld a, ff
ldff(69), a
ldff(69), a
ldff(69), a
ldff(69), a
ldff(69), a
ldff(69), a
xor a, a
ldff(69), a
ldff(69), a
ldff(43), a
ld a, 91
ldff(40), a
lprint_limbo:
jr lprint_limbo
.text@7400
lwaitly_b:
ld c, 44
lwaitly_b_loop:
ldff a, (c)
cmp a, b
jrnz lwaitly_b_loop
ret
.data@7a00
00 00 7f 7f 41 41 41 41
41 41 41 41 41 41 7f 7f
00 00 08 08 08 08 08 08
08 08 08 08 08 08 08 08
00 00 7f 7f 01 01 01 01
7f 7f 40 40 40 40 7f 7f
00 00 7f 7f 01 01 01 01
3f 3f 01 01 01 01 7f 7f
00 00 41 41 41 41 41 41
7f 7f 01 01 01 01 01 01
00 00 7f 7f 40 40 40 40
7e 7e 01 01 01 01 7e 7e
00 00 7f 7f 40 40 40 40
7f 7f 41 41 41 41 7f 7f
00 00 7f 7f 01 01 02 02
04 04 08 08 10 10 10 10
00 00 3e 3e 41 41 41 41
3e 3e 41 41 41 41 3e 3e
00 00 7f 7f 41 41 41 41
7f 7f 01 01 01 01 7f 7f
| 11.890805 | 24 | 0.573224 | [
"MIT"
] | Manurocker95/GiovanniEmulator | GIOVANNI/gambatte/test/hwtests/sprites/10spritesprline_2overlap6_m3stat_ds_1_cgb04c_out3.asm | 2,069 | Assembly |
; A091883: Expansion of (1-5x)/((1+5x)(1-10x)).
; Submitted by Christian Krause
; 1,0,50,250,3750,31250,343750,3281250,33593750,332031250,3339843750,33300781250,333496093750,3332519531250,33337402343750,333312988281250,3333435058593750,33332824707031250,333335876464843750
mov $1,-5
pow $1,$0
mul $1,2
mov $2,10
pow $2,$0
add $1,$2
mov $0,$1
div $0,3
| 27.076923 | 192 | 0.758523 | [
"Apache-2.0"
] | ckrause/loda-programs | oeis/091/A091883.asm | 352 | Assembly |
page 49,132
TITLE EXGOTO - executors for goto and gosub varients
;***
;exgoto - executors for goto and gosub varients
;
; Copyright <C> 1986, Microsoft Corporation
;
;Purpose:
;
;
;****************************************************************************
.xlist
include version.inc
IncludeOnce architec
IncludeOnce context
IncludeOnce debug
IncludeOnce executor
IncludeOnce exint
IncludeOnce opcontrl
IncludeOnce opstmt
IncludeOnce opid
IncludeOnce opaftqb4
IncludeOnce qbimsgs
IncludeOnce rtinterp
IncludeOnce rtps
IncludeOnce txtmgr
.list
assumes cs, CODE
assumes es, NOTHING
assumes ss, DATA
sBegin DATA
externB b$ErrInfo
sEnd DATA
extrn B$EVTRET:far ;RT reentry point for event RETURN
sBegin CODE
subttl GOTO for program and direct mode
EXTRN SetProgramMode:NEAR
page
;------------------------------------------------------------------------------
; GOSUB Frames:
; There are three different GOSUB frames used by QBI -
; (1) Standard frame
; (2) Event GOSUB frame
; (3) GOSUB frame when GOSUB statement occurs in Direct Mode buffer
;
; Standard Frame: Event Frame: Direct Mode Frame:
; Himem
; +--------------+
; | oRs |
; +--------------+
; | oTx |
; +--------------+
; | BP |
; +--------------+
; | b$curframe |
; +--------------+
; | Module |
; | Frame |
; | Temps |
; +--------------+
; | bcurlevel_QBI|
; +--------------+
; |fNonQBI_Active|
; +--------------+ +--------------+ +--------------+
; | oTx | | 1 | | oTx OR 1 |
; +--------------+ +--------------+ +--------------+
; | pGosubLast | | pGosubLast | | pGosubLast |
; +--------------+ +--------------+ +--------------+
; Lomem
;
; Note that only the QBI specific part of the Event Frame is shown above,
; the part that's pushed at the point we know an event has occured and
; the handler is interpreted code.
; Note that valid oTx's will never have the low bit set, so if the
; word on the frame above pGosubLast has the low bit set, it must be
; for an Event GOSUB or a GOSUB from Direct Mode.
;------------------------------------------------------------------------------
;***
;exStGoto,exStGotoDirect, exStGosubDirect, exStGosub
;Purpose:
; Handle direct and program mode versions of GOTO and GOSUB.
;
; For speed, GOTO and GOSUB have special executors for direct and
; program mode.
;
; The GOTO and GOSUB operand is fully bound, that is, it is the oTx
; of the label definition.
;
; Direct mode versions must...
;
;Input:
; es:si = pcode address of operand
;Output:
; es:si updated
;**********************************************************************
MakeExe exStGotoDirect,opStGotoDirect
mov si,PTRTX[si] ;Load destination offset
GotoDirect:
call SetProgramMode ;Preserves si
jmp short DoDisp
MakeExe exStCommon,opStCommon
SkipExHeader
MakeExe exStShared,opStShared
SkipExHeader
MakeExe exStStatic,opStStatic
SkipExHeader
MakeExe exStExitProc,opStExitProc
SkipExHeader
MakeExe exBranch,opNoList1
SkipExHeader
MakeExe exStGoto,opStGoto
mov si,PTRTX[si] ;Make the branch
DoDisp:
DispMac ; and on with the show
MakeExe exBranchRel,opNoList1
add si,PTRTX[si] ;Do a relative branch
jmp SHORT DoDisp
;***
;exStOnGosub,exStOnGoto
;Purpose:
; Handle both direct mode and program mode ON GOTO and ON GOSUB.
;
; ON GOTO and ON GOSUB fall through to the next statement if the
; I2 index argument is out of range, unless the argument is negative
; or greater than 255, in which case an Illegal Function Call error
; is issued.
;
; ON GOSUB pushes a standard GOSUB entry on the stack. See exStGosub.
;
; On entry the pcode contains a word operand which is the count of
; bytes of bound label operands. Following this is the next executor.
;
;Input:
; es:si = pcode address of first operand
; parmW I2 index
;Output:
; es:si updated
; stack cleaned
;***********************************************************************
MakeExe exStOnGosub,opStOnGosub
mov cx,sp ;cx non-zero ON GOSUB
jmp short StOnShared ;to code shared by ON GOSUB/ON GOTO
MakeExe exStOnGoto,opStOnGoto
xor cx,cx ;cx zero indicates ON GOTO
StOnShared:
LODSWTX ;Load operand byte count
pop bx ;I2 index into label list
or bh,bh ;negative number or > 255d?
jnz Ill_Fcn_Call ; brif so
dec bx ;Index is 1-based
shl bx,1 ;To byte index
cmp ax,bx ;Test for branch within range
jbe OnGoRange ;Not in range
add ax,si ;Address of return executor (if GOSUB)
mov si,PTRTX[si+bx] ;setup for Branch
jcxz GotoDirect ;Not an ON GOSUB - skip building a frame
call SetProgramMode ;initialization work if we're coming
; from direct mode. cx = previous value
; of fDirect flag
xchg ax,si ;si = return address oTx, ax = new oTx
jcxz StGosub_Common1 ; brif not Direct Mode GOSUB
jmp short Direct_Gosub
OnGoRange:
add si,ax ;Index to end
jmp short Disp1
Ill_Fcn_Call:
mov al,ER_FC ;Illegal Function Call
SKIP2_PSW ; skip the next MOV instruction
Stack_Overflow: ;insufficient stack space left for
mov al,ER_OM ; recursion
mov [b$ErrInfo],OMErr_STK ;note that this is really Out of Stack
call RtErrorCODE
;***
;exStGosubDirect, exStGosub
;Purpose:
; Handle direct mode and program mode GOSUB.
;
; GOSUB pushes a GOSUB frame on the stack. See top of module for
; description of frame contents.
;
; The static variable pGosubLast identifies the last pushed
; GOSUB frame for the current scope. When a procedure is invoked,
; this static variable is preserved as part of the stack frame, to
; be used for:
; 1. detection of RETURN without GOSUB error.
; 2. walking the stack for edit and continue.
;
; At procedure return, pGosubLast is updated to reflect the GOSUB
; frames active in the return scope.
;
; The location pGosubLast is also used for detecting the lowest
; stack address valid across user error handlers.
;
;******************************************************************************
MakeExe exStGosubDirect,opStGosubDirect
LODSWTX ;Get branch offset
call SetProgramMode ;initialize as necessary (can reset stk)
Direct_Gosub:
or si,1 ;signal that this is a Direct Mode gosub
or [grs.GRS_flags],FG_RetDir
;remember there's a ret adr to
; direct mode buffer on stack.
jmp short StGosub_Common1
MakeExe exStGosub,opStGosub
LODSWTX ;Get destination offset
StGosub_Common1:
push si ;oTx - return address
mov si,ax ;Branch
StGosub_Common:
push pGosubLast ;Frame - last previous GOSUB frame
mov pGosubLast,sp ;Update frame head pointer
cmp sp,[b$pendchk] ;check for stack overflow
jbe Stack_Overflow
DispMac ; and on with the show.
;***
;exStReturn
;Purpose:
; Handle RETURN statement without line number.
;
;Input:
;Output:
;***************************************************************************
MakeExe exStReturn0,opStReturn0
cmp [pGosubLast],sp ;Make sure that's a gosub on the stack
jnz RetWithoutGosub ;NULL,so Return without gosub error
pop [pGosubLast] ;Frame - Update last active gosub frame
pop si ;Frame - Text branch to return
test si,1
jnz EventOrDirectModeReturn ;Handle ON <event> return or
; return to direct mode buffer
Return_Exit:
cmp [grs.GRS_fDirect],FALSE ;RETURN from Direct Mode?
jnz DirectMode_Return ; brif so
Disp1:
DispMac ; and on with the show.
RetWithoutGosub:
mov al,ER_RG ;RETURN without GOSUB error
SKIP2_PSW
CantCont_Err:
mov al,ER_CN ;"Cant Continue" error
call RtErrorCODE
EXTRN Cont_Otx:NEAR ;part of exStCont code
DirectMode_Return:
cmp [grs.GRS_otxCONT],UNDEFINED
;exists context that can be CONTinued?
jz CantCont_Err ; brif not - - issue 'Cant Continue'
jmp Cont_Otx ;share code with exStCont
MakeExe exStReturn1,opStReturn1
;NOTE: if event frame is on stack, can never return to
;NOTE: context of where event occured now? That seems okay.
cmp [pGosubLast],sp ;Make sure that's a gosub on the stack
jnz RetWithoutGosub ;NULL,so Return without gosub error
pop [pGosubLast] ;Frame - Update last active gosub frame
LODSWTX ;load oTx of line to return to
pop si ;Frame - Text branch to return
xchg ax,si ;si = oTx to RETURN to
dec ax ;Event GOSUB?
jnz Return_Exit ; brif not
cmp WORD PTR [bp+8],0 ; did event take place in QB code?
jnz KeepThisFrame ; brif not - keep this module frame
mov ax,[grs.GRS_oRsCur]
cmp ax,[bp+4] ; did event take place at mod. level,
; and in the same module as this
; handler lives in?
jz EventReturn_LineNo ; brif so - - - pop this frame, so
; module-level frame and any active
; gosub frames are useable again ...
KeepThisFrame:
pop ax ;pop off all but the module frame.
pop ax
jmp short Return_Exit
EventReturn_LineNo:
call SetProgramMode ; in case of RETURN from direct mode
pop [fNonQBI_Active] ; restore to previous setting
pop [bcurlevel_QBI] ; restore to previous setting
mov sp,bp
pop bp
pop ax ; discard oTx part of return address
jmp short EventReturn
EventOrDirectModeReturn:
cmp si,1
ja DirectReturn ;brif a RETURN to Direct Mode buffer
call SetProgramMode ;in case of a RETURN from direct mode
pop [fNonQBI_Active] ;restore to previous setting
pop [bcurlevel_QBI] ;restore to previous setting
mov sp,bp
pop bp
pop si
EventReturn:
mov [b$curframe],bp
mov [grs.GRS_oTxCur],si ;in case of an event to QBI code from
; non-QBI code now
pop ax ;ax = oRs to restore
call RsActivateCODE
jmp B$EVTRET ;transfer control back to runtime -
; runtime returns control to the
; context where the event was detected
DirectReturn:
;Returning into direct mode buffer
and si,NOT 1 ;make this a normal oTx
mov [grs.GRS_fDirect],TRUE ;make Direct Mode text buffer active
and [grs.GRS_flags],NOT FG_RetDir
;remember there's no ret adr to
; direct mode buffer on stack.
jmp DispMov ;set up ES and dispatch
;***
;B$IEvHandler - runtime call-back to start an event gosub
;
;Purpose:
; When an event has occured, and the runtime determines that the
; handler exists and is in QBI code, it calls this routine to start
; the event gosub.
;Input:
; DS:BX points to the oTx of the event handler
; DS:BX+2 points to the oMrs of the event handler
;Exit:
; none - just starts the subroutine going. A RETURN executor (above)
; will be responsible returning control back to runtime arbitration.
;***************************************************************************
cProc B$IEvHandler,<FAR,PUBLIC,NODATA>
cBegin
push [grs.GRS_oRsCur] ;so RETURN can restore
push [grs.GRS_oTxCur] ;so RETURN can restore
mov si,[bx] ;fetch gosub oTx from RT event table
mov ax,[bx+2] ;oMrs to activate for event handler
call RsActivateCode
push bp ;push a new module level frame
mov bp,sp
push [b$curframe]
mov [b$curframe],bp
mov bx,[grs.GRS_oMrsCur]
RS_BASE add,bx ; bx points to mrsCur in the Rs table
GETRS_SEG es
xor ax,ax
xchg ax,[fNonQBI_Active] ;must reset this here in case of error
; i.e., remember QBI code is active now
mov dx,sp
mov cx,PTRRS[bx.MRS_cbFrameTemp]
add cx,PTRRS[bx.MRS_cbFrameVars]
dec cx ; pushed b$curframe already accounted
dec cx ; for in sp (cbFrameVars cnts it too
sub dx,cx
jc EvHandler_Overflow ;brif proposed sp value wraps around
cmp dx,[b$pendchk] ;check for stack overflow - - - MUST
; check for this now, so SP can never
; be set to an illegal value
ja EvHandler_Cont ;brif no overflow
EvHandler_Overflow:
jmp Stack_Overflow ;note that the rest of the key context
; (oRsCur, SI) has been set up to
; report the error correctly. Stack
; overflow causes stack to be blasted
; and a CLEAR to occur anyway, so no
; problem that all items didn't get
; pushed on the stack.
EvHandler_Cont:
mov sp,dx ;make room for module level frame stuff
DbAssertTst sp,z,1,CODE,<B$IEvHandler: SP contains an odd number>
;NOTE: No reason to copy existing module frame vars+temps to and back
;NOTE: from this new frame, nor to zero them. Frame temps are only
;NOTE: meaningful within the context of a statement. Frame vars are
;NOTE: only used by FOR loops; not too worried about what happens if
;NOTE: user jumps into the middle of a FOR loop; we can't match what
;NOTE: BC does for that case anyway.
push [bcurlevel_QBI] ;save in case this is modified
push ax ;previous value of fNonQBI_Active -
; remember whether QBI code is active
; or not at context we're to return
; to later
PUSHI ax,1 ;1 (instead of oTx) says "event gosub"
call GetEsDi ;ensure ES & DI setup for execution
jmp StGosub_Common
cEnd <nogen>
sEnd CODE
end
| 32.541966 | 79 | 0.63073 | [
"Apache-2.0"
] | minblock/msdos | 45/qb/ir/exgoto.asm | 13,570 | Assembly |
INCLUDE "constants.asm"
flag_array: MACRO
ds ((\1) + 7) / 8
ENDM
box_struct_length EQU 25 + NUM_MOVES * 2
box_struct: MACRO
\1Species:: db
\1HP:: dw
\1BoxLevel:: db
\1Status:: db
\1Type::
\1Type1:: db
\1Type2:: db
\1CatchRate:: db
\1Moves:: ds NUM_MOVES
\1OTID:: dw
\1Exp:: ds 3
\1HPExp:: dw
\1AttackExp:: dw
\1DefenseExp:: dw
\1SpeedExp:: dw
\1SpecialExp:: dw
\1DVs:: ds 2
\1PP:: ds NUM_MOVES
ENDM
party_struct: MACRO
box_struct \1
\1Level:: db
\1Stats::
\1MaxHP:: dw
\1Attack:: dw
\1Defense:: dw
\1Speed:: dw
\1Special:: dw
ENDM
battle_struct: MACRO
\1Species:: db
\1HP:: dw
\1BoxLevel:: db
\1Status:: db
\1Type::
\1Type1:: db
\1Type2:: db
\1CatchRate:: db
\1Moves:: ds NUM_MOVES
\1DVs:: ds 2
\1Level:: db
\1Stats::
\1MaxHP:: dw
\1Attack:: dw
\1Defense:: dw
\1Speed:: dw
\1Special:: dw
\1PP:: ds NUM_MOVES
ENDM
SECTION "WRAM Bank 0", WRAM0
wUnusedC000:: ; c000
ds 1
wSoundID:: ; c001
ds 1
wMuteAudioAndPauseMusic:: ; c002
; bit 7: whether sound has been muted
; all bits: whether the effective is active
; Store 1 to activate effect (any value in the range [1, 127] works).
; All audio is muted and music is paused. Sfx continues playing until it
; ends normally.
; Store 0 to resume music.
ds 1
wDisableChannelOutputWhenSfxEnds:: ; c003
ds 1
wStereoPanning:: ; c004
ds 1
wSavedVolume:: ; c005
ds 1
wChannelCommandPointers:: ; c006
ds 16
wChannelReturnAddresses:: ; c016
ds 16
wChannelSoundIDs:: ; c026
ds 8
wChannelFlags1:: ; c02e
ds 8
wChannelFlags2:: ; c036
ds 8
wChannelDuties:: ; c03e
ds 8
wChannelDutyCycles:: ; c046
ds 8
wChannelVibratoDelayCounters:: ; c04e
; reloaded at the beginning of a note. counts down until the vibrato begins.
ds 8
wChannelVibratoExtents:: ; c056
ds 8
wChannelVibratoRates:: ; c05e
; high nybble is rate (counter reload value) and low nybble is counter.
; time between applications of vibrato.
ds 8
wChannelFrequencyLowBytes:: ; c066
ds 8
wChannelVibratoDelayCounterReloadValues:: ; c06e
; delay of the beginning of the vibrato from the start of the note
ds 8
wChannelPitchBendLengthModifiers:: ; c076
ds 8
wChannelPitchBendFrequencySteps:: ; c07e
ds 8
wChannelPitchBendFrequencyStepsFractionalPart:: ; c086
ds 8
wChannelPitchBendCurrentFrequencyFractionalPart:: ; c08e
ds 8
wChannelPitchBendCurrentFrequencyHighBytes:: ; c096
ds 8
wChannelPitchBendCurrentFrequencyLowBytes:: ; c09e
ds 8
wChannelPitchBendTargetFrequencyHighBytes:: ; c0a6
ds 8
wChannelPitchBendTargetFrequencyLowBytes:: ; c0ae
ds 8
wChannelNoteDelayCounters:: ; c0b6
; Note delays are stored as 16-bit fixed-point numbers where the integer part
; is 8 bits and the fractional part is 8 bits.
ds 8
wChannelLoopCounters:: ; c0be
ds 8
wChannelNoteSpeeds:: ; c0c6
ds 8
wChannelNoteDelayCountersFractionalPart:: ; c0ce
ds 8
wChannelOctaves:: ; c0d6
ds 8
wChannelVolumes:: ; c0de
; also includes fade for hardware channels that support it
ds 8
wMusicWaveInstrument::
ds 1
wSfxWaveInstrument::
ds 1
wMusicTempo:: ; c0e8
ds 2
wSfxTempo:: ; c0ea
ds 2
wSfxHeaderPointer:: ; c0ec
ds 2
wNewSoundID:: ; c0ee
ds 1
wAudioROMBank:: ; c0ef
ds 1
wAudioSavedROMBank:: ; c0f0
ds 1
wFrequencyModifier:: ; c0f1
ds 1
wTempoModifier:: ; c0f2
ds 1
wc0f3:: ds 1
wc0f4:: ds 1
wc0f5:: ds 11
SECTION "Sprite State Data", WRAM0[$c100]
wSpriteDataStart::
wSpriteStateData1:: ; c100
; data for all sprites on the current map
; holds info for 16 sprites with $10 bytes each
; player sprite is always sprite 0
; C1x0: picture ID (fixed, loaded at map init)
; C1x1: movement status (0: uninitialized, 1: ready, 2: delayed, 3: moving)
; C1x2: sprite image index (changed on update, $ff if off screen, includes facing direction, progress in walking animation and a sprite-specific offset)
; C1x3: Y screen position delta (-1,0 or 1; added to c1x4 on each walking animation update)
; C1x4: Y screen position (in pixels, always 4 pixels above grid which makes sprites appear to be in the center of a tile)
; C1x5: X screen position delta (-1,0 or 1; added to c1x6 on each walking animation update)
; C1x6: X screen position (in pixels, snaps to grid if not currently walking)
; C1x7: intra-animation-frame counter (counting upwards to 4 until c1x8 is incremented)
; C1x8: animation frame counter (increased every 4 updates, hold four states (totalling to 16 walking frames)
; C1x9: facing direction (0: down, 4: up, 8: left, $c: right)
; C1xA
; C1xB
; C1xC
; C1xD
; C1xE
; C1xF
spritestatedata1: MACRO
w\1SpriteStateData1::
w\1PictureID:: db ; 0
w\1MovementStatus:: db ; 1
w\1SpriteImageIdx:: db ; 2
w\1YStepVector:: db ; 3
w\1YPixels:: db ; 4
w\1XStepVector:: db ; 5
w\1XPixels:: db ; 6
w\1IntraAnimFrameCounter:: db ; 7
w\1AnimFrameCounter:: db ; 8
w\1FacingDirection:: db ; 9
ds 6
w\1SpriteStateData1End::
endm
spritestatedata1 Player
spritestatedata1 Sprite01
spritestatedata1 Sprite02
spritestatedata1 Sprite03
spritestatedata1 Sprite04
spritestatedata1 Sprite05
spritestatedata1 Sprite06
spritestatedata1 Sprite07
spritestatedata1 Sprite08
spritestatedata1 Sprite09
spritestatedata1 Sprite10
spritestatedata1 Sprite11
spritestatedata1 Sprite12
spritestatedata1 Sprite13
spritestatedata1 Sprite14
spritestatedata1 Pikachu
; ds $10 * $10
;SECTION "Sprite State Data 2", WRAM0[$c200]
wSpriteStateData2:: ; c200
; more data for all sprites on the current map
; holds info for 16 sprites with $10 bytes each
; player sprite is always sprite 0
; C2x0: walk animation counter (counting from $10 backwards when moving)
; C2x1:
; C2x2: Y displacement (initialized at 8, supposed to keep moving sprites from moving too far, but bugged)
; C2x3: X displacement (initialized at 8, supposed to keep moving sprites from moving too far, but bugged)
; C2x4: Y position (in 2x2 tile grid steps, topmost 2x2 tile has value 4)
; C2x5: X position (in 2x2 tile grid steps, leftmost 2x2 tile has value 4)
; C2x6: movement byte 1 (determines whether a sprite can move, $ff:not moving, $fe:random movements, others unknown)
; C2x7: (?) (set to $80 when in grass, else $0; may be used to draw grass above the sprite)
; C2x8: delay until next movement (counted downwards, status (c1x1) is set to ready if reached 0)
; C2x9
; C2xA
; C2xB
; C2xC
; C2xD
; C2xE: sprite image base offset (in video ram, player always has value 1, used to compute c1x2)
; C2xF
spritestatedata2: MACRO
w\1SpriteStateData2::
w\1WalkAnimationCounter:: db ; 0
ds 1
w\1YDisplacement:: db ; 2
w\1XDisplacement:: db ; 3
w\1MapY:: db ; 4
w\1MapX:: db ; 5
w\1MovementByte1:: db ; 6
w\1GrassPriority:: db ; 7
w\1MovementDelay:: db ; 8
ds 5
w\1SpriteImageBaseOffset:: db ; e
ds 1
w\1SpriteStateData2End::
endm
spritestatedata2 Player
spritestatedata2 Sprite01
spritestatedata2 Sprite02
spritestatedata2 Sprite03
spritestatedata2 Sprite04
spritestatedata2 Sprite05
spritestatedata2 Sprite06
spritestatedata2 Sprite07
spritestatedata2 Sprite08
spritestatedata2 Sprite09
spritestatedata2 Sprite10
spritestatedata2 Sprite11
spritestatedata2 Sprite12
spritestatedata2 Sprite13
spritestatedata2 Sprite14
spritestatedata2 Pikachu
; ds $10 * $10
wSpriteDataEnd::
SECTION "OAM Buffer", WRAM0[$c300]
wOAMBuffer:: ; c300
; buffer for OAM data. Copied to OAM by DMA
ds 4 * 40
wOAMBufferEnd::
wTileMap:: ; c3a0
; buffer for tiles that are visible on screen (20 columns by 18 rows)
ds SCREEN_HEIGHT * SCREEN_WIDTH
wSerialPartyMonsPatchList:: ; c508
; list of indexes to patch with SERIAL_NO_DATA_BYTE after transfer
wTileMapBackup:: ; c508
; buffer for temporarily saving and restoring current screen's tiles
; (e.g. if menus are drawn on top)
; ds 20 * 18
wAnimatedObjectsData::
; Used by functions in BANK 3E
; This looks similar to the address structure for Gen 2 OAM animations.
wAnimatedObjectStartTileOffsets::
ds 10 * 2
wAnimatedObjectDataStructs:: ; c51c
animated_object: macro
\1::
\1Index:: db ; 0
\1FramesetID:: db ; 1
\1AnimSeqID:: db ; 2
\1TileID:: db ; 3
\1XCoord:: db ; 4
\1YCoord:: db ; 5
\1XOffset:: db ; 6
\1YOffset:: db ; 7
\1Duration:: db ; 8
\1DurationOffset:: db ; 9
\1FrameIndex:: db ; a
ds 5
\1End::
endm
animated_object AnimatedObject0
animated_object AnimatedObject1
animated_object AnimatedObject2
animated_object AnimatedObject3
animated_object AnimatedObject4
animated_object AnimatedObject5
animated_object AnimatedObject6
animated_object AnimatedObject7
animated_object AnimatedObject8
animated_object AnimatedObject9
wNumLoadedAnimatedObjects:: ; c5bc
ds 1
wCurrentAnimatedObjectOAMBufferOffset:: ; c5bd
ds 3
wAnimatedObjectSpawnStateDataPointer:: ; c5c0
dw
wAnimatedObjectFramesDataPointer:: ; c5c2
dw
wAnimatedObjectJumptablePointer:: ; c5c4
dw
wAnimatedObjectOAMDataPointer:: ; c5c6
dw
wCurAnimatedObjectOAMAttributes:: ; c5c8
ds 1
wCurrentAnimatedObjectVTileOffset:: ; c5c9
ds 1
wCurrentAnimatedObjectXCoord:: ; c5ca
ds 1
wCurrentAnimatedObjectYCoord:: ; c5cb
ds 1
wCurrentAnimatedObjectXOffset:: ; c5cc
ds 1
wCurrentAnimatedObjectYOffset:: ; c5cd
ds 1
wAnimatedObjectGlobalYOffset:: ; c5ce
ds 1
wAnimatedObjectGlobalXOffset:: ; c5cf
ds 1
wAnimatedObjectsDataEnd::
wSerialEnemyMonsPatchList:: ; c5d0
; list of indexes to patch with SERIAL_NO_DATA_BYTE after transfer
; Surfing Minigame
wSurfingMinigameData:: ; c5d0
ds 1
wSurfingMinigameRoutineNumber:: ; c5d1
ds 1
wc5d2:: ; c5d2
ds 1
wSurfingMinigameWaveFunctionNumber:: ; c5d3
ds 2
wc5d5:: ; c5d5
ds 1
wSurfingMinigamePikachuHP:: ; c5d6
ds 2 ; little-endian BCD
wc5d8:: ; c5d8 unused?
ds 1
wSurfingMinigameRadnessMeter:: ; c5d9
; number of consecutive tricks
ds 1
wSurfingMinigameRadnessScore:: ; c5da
ds 2 ; little-endian BCD
wSurfingMinigameTotalScore:: ; c5dc
ds 2 ; little-endian BCD
wc5de:: ; c5de
ds 1
wc5df:: ; c5df
ds 1
wc5e0:: ; c5e0
ds 1
wc5e1:: ; c5e1
ds 1
wc5e2:: ; c5e2
ds 1
wc5e3:: ; c5e3
ds 2 ; little-endian
wc5e5:: ; c5e5
ds 3 ; big-endian
wSurfingMinigameWaveHeightBuffer:: ; c5e8
ds 2
wSurfingMinigamePikachuObjectHeight:: ; c5ea
ds 1
wc5eb:: ; c5eb
ds 1
wc5ec:: ; c5ec
ds 1
wc5ed:: ; c5ed
ds 1
wc5ee:: ; c5ee
ds 1
wSurfingMinigameBGMapReadBuffer:: ; c5ef
ds 16
ds 24
wSurfingMinigameSCX:: ; c617
ds 3
wSurfingMinigameWaveHeight:: ; c61a
ds SCREEN_WIDTH
wSurfingMinigameXOffset:: ; c62e
ds 1
wSurfingMinigameTrickFlags:: ; c62f
ds 1
wc630:: ; c630
ds 1
wc631:: ; c631
ds 1
wSurfingMinigameRoutineDelay:: ; c632
ds 1
wSurfingMinigameIntroAnimationFinished:: ; c633
ds 1
wYellowIntroCurrentScene:: ; c634
wc634:: ; c634
ds 1
wYellowIntroSceneTimer:: ; c635
wc635:: ; c635
ds 1
wYellowIntroAnimatedObjectStructPointer:: ; c636
ds 1
wSurfingMinigameDataEnd:: ; c637
ds 177
wTempPic:: ; c6e8
wPrinterData:: ; c6e8
wOverworldMap:: ; c6e8
; ds 1300
wPrinterSendState:: ; c6e8
ds 1
wPrinterRowIndex:: ; c6e9
ds 1
; Printer data header
wPrinterDataHeader:: ; c6ea
wc6ea:: ; c6ea
ds 1
wc6eb:: ; c6eb
ds 1
wc6ec:: ; c6ec
ds 1
wc6ed:: ; c6ed
ds 1
wPrinterChecksum:: ; c6ee
dw
wPrinterSerialReceived:: ; c6f0
ds 1
wPrinterStatusReceived:: ; c6f1
; bit 7: set if error 1 (battery low)
; bit 6: set if error 4 (too hot or cold)
; bit 5: set if error 3 (paper jammed or empty)
; if this and the previous byte are both $ff: error 2 (connection error)
ds 1
wc6f2:: ; c6f2
ds 1
wc6f3:: ; c6f3
ds 13
wLYOverrides:: ; c700
ds $100
wLYOverridesEnd::
wLYOverridesBuffer:: ; c800
ds $100
wLYOverridesBufferEnd:: ; c900
ds wPrinterSerialReceived - @
wPrinterSendDataSource1:: ; c6f0
; two 20-tile buffers
ds $140
wPrinterSendDataSource2::
ds $140
wPrinterSendDataSource1End:: ; c970
wPrinterHandshake:: ; c970
ds 1
wPrinterStatusFlags:: ; c971
ds 1
wHandshakeFrameDelay:: ; c972
ds 1
wPrinterSerialFrameDelay:: ; c973
ds 1
wPrinterSendByteOffset:: ; c974
dw
wPrinterDataSize:: ; c976
dw
wPrinterTileBuffer:: ; c978
ds SCREEN_HEIGHT * SCREEN_WIDTH
wPrinterStatusIndicator:: ; cae0
ds 2
wcae2:: ; cae2
ds 1
wPrinterSettingsTempCopy:: ; cae3
ds 17
wPrinterQueueLength:: ; caf4
ds 1
wPrinterDataEnd:: ; caf5
wPrinterPokedexEntryTextPointer:: ; caf5
dw
ds 2
wPrinterPokedexMonIsOwned:: ; caf9
ds 227
wcbdc:: ; cbdc
ds 14
wcbea:: ; cbea
ds 2
wcbec:: ; cbec
ds 16
wRedrawRowOrColumnSrcTiles:: ; cbfc
; the tiles of the row or column to be redrawn by RedrawRowOrColumn
ds SCREEN_WIDTH * 2
; coordinates of the position of the cursor for the top menu item (id 0)
wTopMenuItemY:: ; cc24
ds 1
wTopMenuItemX:: ; cc25
ds 1
wCurrentMenuItem:: ; cc26
; the id of the currently selected menu item
; the top item has id 0, the one below that has id 1, etc.
; note that the "top item" means the top item currently visible on the screen
; add this value to [wListScrollOffset] to get the item's position within the list
ds 1
wTileBehindCursor:: ; cc27
; the tile that was behind the menu cursor's current location
ds 1
wMaxMenuItem:: ; cc28
; id of the bottom menu item
ds 1
wMenuWatchedKeys:: ; cc29
; bit mask of keys that the menu will respond to
ds 1
wLastMenuItem:: ; cc2a
; id of previously selected menu item
ds 1
wPartyAndBillsPCSavedMenuItem:: ; cc2b
; It is mainly used by the party menu to remember the cursor position while the
; menu isn't active.
; It is also used to remember the cursor position of mon lists (for the
; withdraw/deposit/release actions) in Bill's PC so that it doesn't get lost
; when you choose a mon from the list and a sub-menu is shown. It's reset when
; you return to the main Bill's PC menu.
ds 1
wBagSavedMenuItem:: ; cc2c
; It is used by the bag list to remember the cursor position while the menu
; isn't active.
ds 1
wBattleAndStartSavedMenuItem:: ; cc2d
; It is used by the start menu to remember the cursor position while the menu
; isn't active.
; The battle menu uses it so that the cursor position doesn't get lost when
; a sub-menu is shown. It's reset at the start of each battle.
ds 1
wPlayerMoveListIndex:: ; cc2e
ds 1
wPlayerMonNumber:: ; cc2f
; index in party of currently battling mon
ds 1
wMenuCursorLocation:: ; cc30
; the address of the menu cursor's current location within wTileMap
ds 2
ds 2
wMenuJoypadPollCount:: ; cc34
; how many times should HandleMenuInput poll the joypad state before it returns?
ds 1
wMenuItemToSwap:: ; cc35
; id of menu item selected for swapping (counts from 1) (0 means that no menu item has been selected for swapping)
ds 1
wListScrollOffset:: ; cc36
; offset of the current top menu item from the beginning of the list
; keeps track of what section of the list is on screen
ds 1
wMenuWatchMovingOutOfBounds:: ; cc37
; If non-zero, then when wrapping is disabled and the player tries to go past
; the top or bottom of the menu, return from HandleMenuInput. This is useful for
; menus that have too many items to display at once on the screen because it
; allows the caller to scroll the entire menu up or down when this happens.
ds 1
wTradeCenterPointerTableIndex:: ; cc38
ds 1
ds 1
wTextDestinationTileAddrBuffer:: dw ; cc3a
wDoNotWaitForButtonPressAfterDisplayingText:: ; cc3c
; if non-zero, skip waiting for a button press after displaying text in DisplayTextID
ds 1
wSerialSyncAndExchangeNybbleReceiveData:: ; cc3d
; the final received nybble is stored here by Serial_SyncAndExchangeNybble
wSerialExchangeNybbleTempReceiveData:: ; cc3d
; temporary nybble used by Serial_ExchangeNybble
wLinkMenuSelectionReceiveBuffer:: ; cc3d
; two byte buffer
; the received menu selection is stored twice
ds 1
wSerialExchangeNybbleReceiveData:: ; cc3e
; the final received nybble is stored here by Serial_ExchangeNybble
ds 1
ds 3
wSerialExchangeNybbleSendData:: ; cc42
; this nybble is sent when using Serial_SyncAndExchangeNybble or Serial_ExchangeNybble
wLinkMenuSelectionSendBuffer:: ; cc42
; two byte buffer
; the menu selection byte is stored twice before sending
ds 5
wLinkTimeoutCounter:: ; cc47
; 1 byte
wUnknownSerialCounter:: ; cc47
; 2 bytes
wEnteringCableClub:: ; cc47
ds 2
wWhichTradeMonSelectionMenu:: ; cc49
; $00 = player mons
; $01 = enemy mons
wMonDataLocation:: ; cc49
; 0 = player's party
; 1 = enemy party
; 2 = current box
; 3 = daycare
; 4 = in-battle mon
;
; AddPartyMon uses it slightly differently.
; If the lower nybble is 0, the mon is added to the player's party, else the enemy's.
; If the entire value is 0, then the player is allowed to name the mon.
ds 1
wMenuWrappingEnabled:: ; cc4a
; set to 1 if you can go from the bottom to the top or top to bottom of a menu
; set to 0 if you can't go past the top or bottom of the menu
ds 1
wCheckFor180DegreeTurn:: ; cc4b
; whether to check for 180-degree turn (0 = don't, 1 = do)
ds 1
ds 1
wMissableObjectIndex:: ; cc4d
ds 1
wPredefID:: ; cc4e
ds 1
wPredefRegisters:: ; cc4f
ds 6
wTrainerHeaderFlagBit:: ; cc55
ds 1
ds 1
wNPCMovementScriptPointerTableNum:: ; cc57
; which NPC movement script pointer is being used
; 0 if an NPC movement script is not running
ds 1
wNPCMovementScriptBank:: ; cc58
; ROM bank of current NPC movement script
ds 1
ds 2
wUnusedCC5B:: ; cc5b
wVermilionDockTileMapBuffer:: ; cc5b
; 180 bytes
wOaksAideRewardItemName:: ; cc5b
wDexRatingNumMonsSeen:: ; cc5b
wFilteredBagItems:: ; cc5b
; List of bag items that has been filtered to a certain type of items,
; such as drinks or fossils.
wElevatorWarpMaps:: ; cc5b
wMonPartySpritesSavedOAM:: ; cc5b
; Saved copy of OAM for the first frame of the animation to make it easy to
; flip back from the second frame.
; $60 bytes
wTrainerCardBlkPacket:: ; cc5b
; $40 bytes
wSlotMachineSevenAndBarModeChance:: ; cc5b
; If a random number greater than this value is generated, then the player is
; allowed to have three 7 symbols or bar symbols line up.
; So, this value is actually the chance of NOT entering that mode.
; If the slot is lucky, it equals 250, giving a 5/256 (~2%) chance.
; Otherwise, it equals 253, giving a 2/256 (~0.8%) chance.
wHallOfFame:: ; cc5b
wBoostExpByExpAll:: ; cc5b
wAnimationType:: ; cc5b
; values between 0-6. Shake screen horizontally, shake screen vertically, blink Pokemon...
wNPCMovementDirections:: ; cc5b
wPikaPicUsedGFXCount:: ; cc5b
ds 1
wPikaPicUsedGFX:: ; cc5c
wDexRatingNumMonsOwned:: ; cc5c
ds 1
wDexRatingText:: ; cc5d
wTrainerCardBadgeAttributes:: ; cc5d
ds 1
wSlotMachineSavedROMBank:: ; cc5e
; ROM back to return to when the player is done with the slot machine
ds 1
ds 13
wPikaPicUsedGFXEnd:: ; cc6c
ds 13
wAnimPalette:: ; cc79
ds 1
ds 29
wNPCMovementDirections2:: ; cc97
wPikaPicAnimObjectDataBufferSize:: ; cc97
wSwitchPartyMonTempBuffer:: ; cc97
; temporary buffer when swapping party mon data
ds 1
wPikaPicAnimObjectDataBuffer:: ; cc98
; 4 structs each of length 8
; 0: buffer index
; 1: script index
; 2: frame index
; 3: frame timer
; 4: vtile offset
; 5: x offset
; 6: y offset
; 7: unused
ds 9
wNumStepsToTake:: ; cca1
; used in Pallet Town scripted movement
ds 23
wPikaPicAnimObjectDataBufferEnd:: ;ccb8
ds 26
wRLEByteCount:: ; ccd2
ds 1
wAddedToParty:: ; ccd3
; 0 = not added
; 1 = added
wSimulatedJoypadStatesEnd:: ; ccd3
; this is the end of the joypad states
; the list starts above this address and extends downwards in memory until here
; overloaded with below labels
wParentMenuItem:: ; ccd3
wCanEvolveFlags:: ; ccd3
; 1 flag for each party member indicating whether it can evolve
; The purpose of these flags is to track which mons levelled up during the
; current battle at the end of the battle when evolution occurs.
; Other methods of evolution simply set it by calling TryEvolvingMon.
ds 1
wForceEvolution:: ; ccd4
ds 1
; if [ccd5] != 1, the second AI layer is not applied
wAILayer2Encouragement:: ; ccd5
ds 1
ds 1
; current HP of player and enemy substitutes
wPlayerSubstituteHP:: ; ccd7
ds 1
wEnemySubstituteHP:: ; ccd8
ds 1
wTestBattlePlayerSelectedMove:: ; ccd9
; The player's selected move during a test battle.
; InitBattleVariables sets it to the move Pound.
ds 1
ds 1
wMoveMenuType:: ; ccdb
; 0=regular, 1=mimic, 2=above message box (relearn, heal pp..)
ds 1
wPlayerSelectedMove:: ; ccdc
ds 1
wEnemySelectedMove:: ; ccdd
ds 1
wLinkBattleRandomNumberListIndex:: ; ccde
ds 1
wAICount:: ; ccdf
; number of times remaining that AI action can occur
ds 1
ds 2
wEnemyMoveListIndex:: ; cce2
ds 1
wLastSwitchInEnemyMonHP:: ; cce3
; The enemy mon's HP when it was switched in or when the current player mon
; was switched in, which was more recent.
; It's used to determine the message to print when switching out the player mon.
ds 2
wTotalPayDayMoney:: ; cce5
; total amount of money made using Pay Day during the current battle
ds 3
wSafariEscapeFactor:: ; cce8
ds 1
wSafariBaitFactor:: ; cce9
ds 1;
ds 1
wTransformedEnemyMonOriginalDVs:: ; cceb
ds 2
wMonIsDisobedient:: ds 1 ; cced
wPlayerDisabledMoveNumber:: ds 1 ; ccee
wEnemyDisabledMoveNumber:: ds 1 ; ccef
wInHandlePlayerMonFainted:: ; ccf0
; When running in the scope of HandlePlayerMonFainted, it equals 1.
; When running in the scope of HandleEnemyMonFainted, it equals 0.
ds 1
wPlayerUsedMove:: ds 1 ; ccf1
wEnemyUsedMove:: ds 1 ; ccf2
wEnemyMonMinimized:: ds 1 ; ccf3
wMoveDidntMiss:: ds 1 ; ccf4
wPartyFoughtCurrentEnemyFlags:: ; ccf5
; flags that indicate which party members have fought the current enemy mon
flag_array 6
wLowHealthAlarmDisabled:: ; ccf6
; Whether the low health alarm has been disabled due to the player winning the
; battle.
ds 1
wPlayerMonMinimized:: ; ccf7
ds 1
ds 2
wEXPBarPixelLength:: ds 1
wEXPBarBaseEXP:: ds 3
wEXPBarCurEXP:: ds 3
wEXPBarNeededEXP:: ds 3
wEXPBarKeepFullFlag:: ds 1
wLuckySlotHiddenObjectIndex:: ; cd05
wEnemyNumHits:: ; cd05
; number of hits by enemy in attacks like Double Slap, etc.
wEnemyBideAccumulatedDamage:: ; cd05
; the amount of damage accumulated by the enemy while biding (2 bytes)
ds 10
wInGameTradeGiveMonSpecies:: ; cd0f
wPlayerMonUnmodifiedLevel:: ; cd0f
ds 1
wInGameTradeTextPointerTablePointer:: ; cd10
wPlayerMonUnmodifiedMaxHP:: ; cd10
ds 2
wInGameTradeTextPointerTableIndex:: ; cd12
wPlayerMonUnmodifiedAttack:: ; cd12
ds 1
wInGameTradeGiveMonName:: ; cd13
ds 1
wPlayerMonUnmodifiedDefense:: ; cd14
ds 2
wPlayerMonUnmodifiedSpeed:: ; cd16
ds 2
wPlayerMonUnmodifiedSpecial:: ; cd18
ds 2
; stat modifiers for the player's current pokemon
; value can range from 1 - 13 ($1 to $D)
; 7 is normal
wPlayerMonStatMods::
wPlayerMonAttackMod:: ; cd1a
ds 1
wPlayerMonDefenseMod:: ; cd1b
ds 1
wPlayerMonSpeedMod:: ; cd1c
ds 1
wPlayerMonSpecialMod:: ; cd1d
ds 1
wInGameTradeReceiveMonName:: ; cd1e
wPlayerMonAccuracyMod:: ; cd1e
ds 1
wPlayerMonEvasionMod:: ; cd1f
ds 1
ds 3
wEnemyMonUnmodifiedLevel:: ; cd23
ds 1
wEnemyMonUnmodifiedMaxHP:: ; cd24
ds 2
wEnemyMonUnmodifiedAttack:: ; cd26
ds 2
wEnemyMonUnmodifiedDefense:: ; cd28
ds 1
wInGameTradeMonNick:: ; cd29
ds 1
wEnemyMonUnmodifiedSpeed:: ; cd2a
ds 2
wEnemyMonUnmodifiedSpecial:: ; cd2c
ds 1
wEngagedTrainerClass:: ; cd2d
ds 1
wEngagedTrainerSet:: ; cd2e
; ds 1
; stat modifiers for the enemy's current pokemon
; value can range from 1 - 13 ($1 to $D)
; 7 is normal
wEnemyMonStatMods::
wEnemyMonAttackMod:: ; cd2e
ds 1
wEnemyMonDefenseMod:: ; cd2f
ds 1
wEnemyMonSpeedMod:: ; cd30
ds 1
wEnemyMonSpecialMod:: ; cd31
ds 1
wEnemyMonAccuracyMod:: ; cd32
ds 1
wEnemyMonEvasionMod:: ; cd33
ds 1
wInGameTradeReceiveMonSpecies:: ; cd34
ds 1
ds 2
wNPCMovementDirections2Index:: ; cd37
wUnusedCD37:: ; cd37
wFilteredBagItemsCount:: ; cd37
; number of items in wFilteredBagItems list
ds 1
wSimulatedJoypadStatesIndex:: ; cd38
; the next simulated joypad state is at wSimulatedJoypadStatesEnd plus this value minus 1
; 0 if the joypad state is not being simulated
ds 1
wWastedByteCD39:: ; cd39
; written to but nothing ever reads it
ds 1
wWastedByteCD3A:: ; cd3a
; written to but nothing ever reads it
ds 1
wOverrideSimulatedJoypadStatesMask:: ; cd3b
; mask indicating which real button presses can override simulated ones
; XXX is it ever not 0?
ds 1
ds 1
wFallingObjectsMovementData:: ; cd3d
; up to 20 bytes (one byte for each falling object)
wSavedY:: ; cd3d
wTempSCX:: ; cd3d
wBattleTransitionCircleScreenQuadrantY:: ; cd3d
; 0 = upper half (Y < 9)
; 1 = lower half (Y >= 9)
wBattleTransitionCopyTilesOffset:: ; cd3d
; 2 bytes
; after 1 row/column has been copied, the offset to the next one to copy from
wInwardSpiralUpdateScreenCounter:: ; cd3d
; counts down from 7 so that every time 7 more tiles of the spiral have been
; placed, the tile map buffer is copied to VRAM so that progress is visible
wHoFTeamIndex:: ; cd3d
wSSAnneSmokeDriftAmount:: ; cd3d
; multiplied by 16 to get the number of times to go right by 2 pixels
wRivalStarterTemp:: ; cd3d
wBoxMonCounts:: ; cd3d
; 12 bytes
; array of the number of mons in each box
wDexMaxSeenMon:: ; cd3d
wPPRestoreItem:: ; cd3d
wWereAnyMonsAsleep:: ; cd3d
wCanPlaySlots:: ; cd3d
wNumShakes:: ; cd3d
wDayCareStartLevel:: ; cd3d
; the level of the mon at the time it entered day care
wWhichBadge:: ; cd3d
wPriceTemp:: ; cd3d
; 3-byte BCD number
wTitleScreenScene:: ; cd3d
wPlayerCharacterOAMTile:: ; cd3d
wMoveDownSmallStarsOAMCount:: ; cd3d
; the number of small stars OAM entries to move down
wChargeMoveNum:: ; cd3d
wCoordIndex:: ; cd3d
wOptionsTextSpeedCursorX:: ; cd3d
wOptionsCursorLocation:: ; cd3d
wTrainerInfoTextBoxWidthPlus1:: ; cd3d
wSwappedMenuItem:: ; cd3d
wHoFMonSpecies:: ; cd3d
wFieldMoves:: ; cd3d
; 4 bytes
; the current mon's field moves
wBadgeNumberTile:: ; cd3d
; tile ID of the badge number being drawn
wRodResponse:: ; cd3d
; 0 = no bite
; 1 = bite
; 2 = no fish on map
wWhichTownMapLocation:: ; cd3d
wStoppingWhichSlotMachineWheel:: ; cd3d
; which wheel the player is trying to stop
; 0 = none, 1 = wheel 1, 2 = wheel 2, 3 or greater = wheel 3
wTradedPlayerMonSpecies:: ; cd3d
wTradingWhichPlayerMon:: ; cd3d
wChangeBoxSavedMapTextPointer:: ; cd3d
wFlyAnimUsingCoordList:: ; cd3d
wPlayerSpinInPlaceAnimFrameDelay:: ; cd3d
wPlayerSpinWhileMovingUpOrDownAnimDeltaY:: ; cd3d
wBoxNumString:: ; cd3d
wHiddenObjectFunctionArgument:: ; cd3d
wWhichTrade:: ; cd3d
; which entry from TradeMons to select
wTrainerSpriteOffset:: ; cd3d
wUnusedCD3D:: ; cd3d
ds 1
wTitleScreenTimer:: ; cd3e
wHUDPokeballGfxOffsetX:: ; cd3e
; difference in X between the next ball and the current one
wBattleTransitionCircleScreenQuadrantX:: ; cd3e
; 0 = left half (X < 10)
; 1 = right half (X >= 10)
wSSAnneSmokeX:: ; cd3e
wRivalStarterBallSpriteIndex:: ; cd3e
wDayCareNumLevelsGrown:: ; cd3e
wOptionsBattleAnimCursorX:: ; cd3e
wTrainerInfoTextBoxWidth:: ; cd3e
wHoFPartyMonIndex:: ; cd3e
wNumCreditsMonsDisplayed:: ; cd3e
; the number of credits mons that have been displayed so far
wBadgeNameTile:: ; cd3e
; first tile ID of the name being drawn
wFlyLocationsList:: ; cd3e
; 11 bytes plus $ff sentinel values at each end
wSlotMachineWheel1Offset:: ; cd3e
wTradedEnemyMonSpecies:: ; cd3e
wTradingWhichEnemyMon:: ; cd3e
wFlyAnimCounter:: ; cd3e
wPlayerSpinInPlaceAnimFrameDelayDelta:: ; cd3e
wPlayerSpinWhileMovingUpOrDownAnimMaxY:: ; cd3e
wHiddenObjectFunctionRomBank:: ; cd3e
wTrainerEngageDistance:: ; cd3e
wJigglypuffFacingDirections2:: ; cd3e
ds 1
wHUDGraphicsTiles:: ; cd3f
; 3 bytes
wDayCareTotalCost:: ; cd3f
; 2-byte BCD number
wJigglypuffFacingDirections:: ; cd3f
wOptionsBattleStyleCursorX:: ; cd3f
wTrainerInfoTextBoxNextRowOffset:: ; cd3f
wHoFMonLevel:: ; cd3f
wBadgeOrFaceTiles:: ; cd3f
; 8 bytes
; a list of the first tile IDs of each badge or face (depending on whether the
; badge is owned) to be drawn on the trainer screen
wSlotMachineWheel2Offset:: ; cd3f
wNameOfPlayerMonToBeTraded:: ; cd3f
wFlyAnimBirdSpriteImageIndex:: ; cd3f
wPlayerSpinInPlaceAnimFrameDelayEndValue:: ; cd3f
wPlayerSpinWhileMovingUpOrDownAnimFrameDelay:: ; cd3f
wHiddenObjectIndex:: ; cd3f
wTrainerFacingDirection:: ; cd3f
ds 1
wHoFMonOrPlayer:: ; cd40
; show mon or show player?
; 0 = mon
; 1 = player
wSlotMachineWheel3Offset:: ; cd40
wPlayerSpinInPlaceAnimSoundID:: ; cd40
wHiddenObjectY:: ; cd40
wTrainerScreenY:: ; cd40
wUnusedCD40:: ; cd40
ds 1
wDayCarePerLevelCost:: ; cd41
; 2-byte BCD number (always set to $0100)
wHoFTeamIndex2:: ; cd41
wHiddenItemOrCoinsIndex:: ; cd41
wTradedPlayerMonOT:: ; cd41
wHiddenObjectX:: ; cd41
wSlotMachineWinningSymbol:: ; cd41
; the OAM tile number of the upper left corner of the winning symbol minus 2
wNumFieldMoves:: ; cd41
wSlotMachineWheel1BottomTile:: ; cd41
wTrainerScreenX:: ; cd41
ds 1
; a lot of the uses for these values use more than the said address
wHoFTeamNo:: ; cd42
wSlotMachineWheel1MiddleTile:: ; cd42
wFieldMovesLeftmostXCoord:: ; cd42
wcd42:: ; cd42
ds 1
wLastFieldMoveID:: ; cd43
; unused
wSlotMachineWheel1TopTile:: ; cd43
ds 1
wSlotMachineWheel2BottomTile:: ; cd44
ds 1
wSlotMachineWheel2MiddleTile:: ; cd45
ds 1
wTempCoins1:: ; cd46
; 2 bytes
; temporary variable used to add payout amount to the player's coins
wSlotMachineWheel2TopTile:: ; cd46
ds 1
wBattleTransitionSpiralDirection:: ; cd47
; 0 = outward, 1 = inward
wSlotMachineWheel3BottomTile:: ; cd47
ds 1
wSlotMachineWheel3MiddleTile:: ; cd48
wFacingDirectionList:: ; cd48
; 4 bytes (also, the byte before the start of the list (cd47) is used a temp
; variable when the list is rotated)
; used when spinning the player's sprite
ds 1
wSlotMachineWheel3TopTile:: ; cd49
wTempObtainedBadgesBooleans::
; 8 bytes
; temporary list created when displaying the badges on the trainer screen
; one byte for each badge; 0 = not obtained, 1 = obtained
ds 1
wTempCoins2:: ; cd4a
; 2 bytes
; temporary variable used to subtract the bet amount from the player's coins
wPayoutCoins:: ; cd4a
; 2 bytes
ds 2
wTradedPlayerMonOTID:: ; cd4c
wSlotMachineFlags:: ; cd4c
; These flags are set randomly and control when the wheels stop.
; bit 6: allow the player to win in general
; bit 7: allow the player to win with 7 or bar (plus the effect of bit 6)
ds 1
wSlotMachineWheel1SlipCounter:: ; cd4d
; wheel 1 can "slip" while this is non-zero
wCutTile:: ; cd4d
; $3d = tree tile
; $52 = grass tile
ds 1
wSlotMachineWheel2SlipCounter:: ; cd4e
; wheel 2 can "slip" while this is non-zero
wTradedEnemyMonOT:: ; cd4e
ds 1
wSavedPlayerScreenY:: ; cd4f
wSlotMachineRerollCounter:: ; cd4f
; The remaining number of times wheel 3 will roll down a symbol until a match is
; found, when winning is enabled. It's initialized to 4 each bet.
wEmotionBubbleSpriteIndex:: ; cd4f
; the index of the sprite the emotion bubble is to be displayed above
ds 1
wWhichEmotionBubble:: ; cd50
wSlotMachineBet:: ; cd50
; how many coins the player bet on the slot machine (1 to 3)
wSavedPlayerFacingDirection:: ; cd50
wWhichAnimationOffsets:: ; cd50
; 0 = cut animation, 1 = boulder dust animation
ds 9
wTradedEnemyMonOTID:: ; cd59
ds 2
wStandingOnWarpPadOrHole:: ; cd5b
; 0 = neither
; 1 = warp pad
; 2 = hole
wOAMBaseTile:: ; cd5b
wGymTrashCanIndex:: ; cd5b
ds 1
wSymmetricSpriteOAMAttributes:: ; cd5c
ds 1
wMonPartySpriteSpecies:: ; cd5d
ds 1
wLeftGBMonSpecies:: ; cd5e
; in the trade animation, the mon that leaves the left gameboy
ds 1
wRightGBMonSpecies:: ; cd5f
; in the trade animation, the mon that leaves the right gameboy
ds 1
wFlags_0xcd60:: ; cd60
; bit 0: is player engaged by trainer (to avoid being engaged by multiple trainers simultaneously)
; bit 1: boulder dust animation (from using Strength) pending
; bit 3: using generic PC
; bit 5: don't play sound when A or B is pressed in menu
; bit 6: tried pushing against boulder once (you need to push twice before it will move)
ds 1
ds 9
wActionResultOrTookBattleTurn:: ; cd6a
; This has overlapping related uses.
; When the player tries to use an item or use certain field moves, 0 is stored
; when the attempt fails and 1 is stored when the attempt succeeds.
; In addition, some items store 2 for certain types of failures, but this
; cannot happen in battle.
; In battle, a non-zero value indicates the player has taken their turn using
; something other than a move (e.g. using an item or switching pokemon).
; So, when an item is successfully used in battle, this value becomes non-zero
; and the player is not allowed to make a move and the two uses are compatible.
ds 1
wJoyIgnore:: ; cd6b
; Set buttons are ignored.
ds 1
wDownscaledMonSize:: ; cd6c
; size of downscaled mon pic used in pokeball entering/exiting animation
; $00 = 5×5
; $01 = 3×3
wNumMovesMinusOne:: ; cd6c
; FormatMovesString stores the number of moves minus one here
ds 1
wcd6d:: ds 4 ; buffer for various data
wStatusScreenCurrentPP:: ; cd71
; temp variable used to print a move's current PP on the status screen
ds 1
ds 6
wNormalMaxPPList:: ; cd78
; list of normal max PP (without PP up) values
ds 9
wSerialOtherGameboyRandomNumberListBlock:: ; cd81
; buffer for transferring the random number list generated by the other gameboy
wTileMapBackup2:: ; cd81
; second buffer for temporarily saving and restoring current screen's tiles (e.g. if menus are drawn on top)
ds 20 * 18
wNamingScreenNameLength:: ; cee9
wEvoOldSpecies:: ; cee9
wBuffer:: ; cee9
; Temporary storage area of 30 bytes.
wTownMapCoords:: ; cee9
; lower nybble is x, upper nybble is y
wLearningMovesFromDayCare:: ; cee9
; whether WriteMonMoves is being used to make a mon learn moves from day care
; non-zero if so
wChangeMonPicEnemyTurnSpecies:: ; cee9
wHPBarMaxHP:: ; cee9
ds 1
wNamingScreenSubmitName:: ; ceea
; non-zero when the player has chosen to submit the name
wChangeMonPicPlayerTurnSpecies:: ; ceea
wEvoNewSpecies:: ; ceea
ds 1
wAlphabetCase:: ; ceeb
; 0 = upper case
; 1 = lower case
wEvoMonTileOffset:: ; ceeb
wHPBarOldHP:: ; ceeb
ds 1
wEvoCancelled:: ; ceec
ds 1
wNamingScreenLetter:: ; ceed
wHPBarNewHP:: ; ceed
ds 2
wHPBarDelta:: ; ceef
ds 1
wHPBarTempHP:: ; cef0
ds 2
ds 11
wHPBarHPDifference:: ; cefd
ds 1
ds 7
wAIItem:: ; cf05
; the item that the AI used
ds 1
wUsedItemOnWhichPokemon:: ; cf06
ds 1
wAnimSoundID:: ; cf07
; sound ID during battle animations
ds 1
wBankswitchHomeSavedROMBank:: ; cf08
; used as a storage value for the bank to return to after a BankswitchHome (bankswitch in homebank)
ds 1
wBankswitchHomeTemp:: ; cf09
; used as a temp storage value for the bank to switch to
ds 1
wBoughtOrSoldItemInMart:: ; cf0a
; 0 = nothing bought or sold in pokemart
; 1 = bought or sold something in pokemart
; this value is not used for anything
ds 1
wBattleResult:: ; cf0b
; $00 - win
; $01 - lose
; $02 - draw
ds 1
wAutoTextBoxDrawingControl:: ; cf0c
; bit 0: if set, DisplayTextID automatically draws a text box
ds 1
wcf0d:: ds 1 ; used with some overworld scripts (not exactly sure what it's used for)
wTilePlayerStandingOn:: ; cf0e
; used in CheckForTilePairCollisions2 to store the tile the player is on
ds 1
wNPCNumScriptedSteps:: ds 1 ; cf0f
wNPCMovementScriptFunctionNum:: ; cf10
; which script function within the pointer table indicated by
; wNPCMovementScriptPointerTableNum
ds 1
wTextPredefFlag:: ; cf11
; bit 0: set when printing a text predef so that DisplayTextID doesn't switch
; to the current map's bank
ds 1
wPredefParentBank:: ; cf12
ds 1
wSpriteIndex:: ds 1 ; cf13
wCurSpriteMovement2:: ; cf14
; movement byte 2 of current sprite
ds 1
ds 2
wNPCMovementScriptSpriteOffset:: ; cf17
; sprite offset of sprite being controlled by NPC movement script
ds 1
wScriptedNPCWalkCounter:: ; cf18
ds 1
ds 1
wOnSGB:: ; cf1a
; if running on SGB, it's 1, else it's 0
ds 1
wDefaultPaletteCommand:: ; cf1b
ds 1
wPlayerHPBarColor:: ; cf1c
wWholeScreenPaletteMonSpecies:: ; cf1c
; species of the mon whose palette is used for the whole screen
ds 1
wEnemyHPBarColor:: ; cf1d
ds 1
; 0: green
; 1: yellow
; 2: red
wPartyMenuHPBarColors:: ; cf1e
ds 6
wStatusScreenHPBarColor:: ; cf25
ds 1
ds 7
wCopyingSGBTileData:: ; c2fd
wWhichPartyMenuHPBar:: ; cf2d
wPalPacket:: ; cf2d
ds 1
wPartyMenuBlkPacket:: ; cf2e
; $30 bytes
ds 9
wPartyHPBarAttributes:: ; cf36
ds 20
wExpAmountGained:: ; cf4a
; 2-byte big-endian number
; the total amount of exp a mon gained
wcf4b:: ds 2 ; storage buffer for various strings
wGainBoostedExp:: ; cf4c
ds 1
ds 17
wGymCityName:: ; cf5e
ds 17
wGymLeaderName:: ; cf6f
ds NAME_LENGTH
wItemList:: ; cf7a
ds 16
wListPointer:: ; cf8a
ds 2
wUnusedCF8D:: ; cf8c
; 2 bytes
; used to store pointers, but never read
wTempMoveID::
wTemp::
wGenderTemp::
ds 2
wItemPrices:: ; cf8e
ds 2
wcf91:: ds 1 ; used with a lot of things (too much to list here) ; cf90
wWhichPokemon:: ; cf91
; which pokemon you selected
ds 1
wPrintItemPrices:: ; cf92
; if non-zero, then print item prices when displaying lists
ds 1
wHPBarType:: ; cf93
; type of HP bar
; $00 = enemy HUD in battle
; $01 = player HUD in battle / status screen
; $02 = party menu
wListMenuID:: ; cf93
; ID used by DisplayListMenuID
ds 1
wRemoveMonFromBox:: ; cf94
; if non-zero, RemovePokemon will remove the mon from the current box,
; else it will remove the mon from the party
wMoveMonType:: ; cf94
; 0 = move from box to party
; 1 = move from party to box
; 2 = move from daycare to party
; 3 = move from party to daycare
ds 1
wItemQuantity:: ; cf95
ds 1
wMaxItemQuantity:: ; cf96
ds 1
; LoadMonData copies mon data here
wLoadedMon:: party_struct wLoadedMon ; cf97
wFontLoaded:: ; cfc3
; bit 0: The space in VRAM that is used to store walk animation tile patterns
; for the player and NPCs is in use for font tile patterns.
; This means that NPC movement must be disabled.
; The other bits are unused.
ds 1
wWalkCounter:: ; cfc4
; walk animation counter
ds 1
wTileInFrontOfPlayer:: ; cfc5
; background tile number in front of the player (either 1 or 2 steps ahead)
ds 1
wAudioFadeOutControl:: ; cfc6
; The desired fade counter reload value is stored here prior to calling
; PlaySound in order to cause the current music to fade out before the new
; music begins playing. Storing 0 causes no fade out to occur and the new music
; to begin immediately.
; This variable has another use related to fade-out, as well. PlaySound stores
; the sound ID of the music that should be played after the fade-out is finished
; in this variable. FadeOutAudio checks if it's non-zero every V-Blank and
; fades out the current audio if it is. Once it has finished fading out the
; audio, it zeroes this variable and starts playing the sound ID stored in it.
ds 1
wAudioFadeOutCounterReloadValue:: ; cfc7
ds 1
wAudioFadeOutCounter:: ; cfc8
ds 1
wLastMusicSoundID:: ; cfc9
; This is used to determine whether the default music is already playing when
; attempting to play the default music (in order to avoid restarting the same
; music) and whether the music has already been stopped when attempting to
; fade out the current music (so that the new music can be begin immediately
; instead of waiting).
; It sometimes contains the sound ID of the last music played, but it may also
; contain $ff (if the music has been stopped) or 0 (because some routines zero
; it in order to prevent assumptions from being made about the current state of
; the music).
ds 1
wUpdateSpritesEnabled:: ; cfca
; $00 = causes sprites to be hidden and the value to change to $ff
; $01 = enabled
; $ff = disabled
; other values aren't used
ds 1
wEnemyMoveNum:: ; cfcb
ds 1
wEnemyMoveEffect:: ; cfcc
ds 1
wEnemyMovePower:: ; cfcd
ds 1
wEnemyMoveType:: ; cfce
ds 1
wEnemyMoveAccuracy:: ; cfcf
ds 1
wEnemyMoveMaxPP:: ; cfd0
ds 1
wPlayerMoveNum:: ; cfd1
ds 1
wPlayerMoveEffect:: ; cfd2
ds 1
wPlayerMovePower:: ; cfd3
ds 1
wPlayerMoveType:: ; cfd4
ds 1
wPlayerMoveAccuracy:: ; cfd5
ds 1
wPlayerMoveMaxPP:: ; cfd6
ds 1
wEnemyMonSpecies2:: ; cfd7
ds 1
wBattleMonSpecies2:: ; cfd8
ds 1
wEnemyMonNick:: ds NAME_LENGTH ; cfd9
wEnemyMon:: ; cfe4
; The wEnemyMon struct reaches past 0xcfff,
; the end of wram bank 0 on cgb.
; This has no significance on dmg, where wram
; isn't banked (c000-dfff is contiguous).
; However, recent versions of rgbds have replaced
; dmg-style wram with cgb wram banks.
; Until this is fixed, this struct will have
; to be declared manually.
wEnemyMonSpecies:: db
wEnemyMonHP:: dw
wEnemyMonPartyPos::
wEnemyMonBoxLevel:: db
wEnemyMonStatus:: db
wEnemyMonType::
wEnemyMonType1:: db
wEnemyMonType2:: db
wEnemyMonCatchRate_NotReferenced:: db
wEnemyMonMoves:: ds NUM_MOVES
wEnemyMonDVs:: ds 2
wEnemyMonLevel:: db
wEnemyMonMaxHP:: dw
wEnemyMonAttack:: dw
wEnemyMonDefense:: dw
wEnemyMonSpeed:: dw
wEnemyMonSpecial:: dw
wEnemyMonPP:: ds 3 ; NUM_MOVES - 1
SECTION "WRAM Bank 1", WRAMX, BANK[1]
ds 1 ; NUM_MOVES - 3
wEnemyMonBaseStats:: ds 5
wEnemyMonCatchRate:: ds 1
wEnemyMonBaseExp:: ds 1
wBattleMonNick:: ds NAME_LENGTH ; d008
wBattleMon:: battle_struct wBattleMon ; d013
wTrainerClass:: ; d030
ds 1
ds 1
wTrainerPicPointer:: ; d032
ds 2
ds 1
wTempMoveNameBuffer:: ; d035
wLearnMoveMonName:: ; d035
; The name of the mon that is learning a move.
ds 16
wTrainerBaseMoney:: ; d045
; 2-byte BCD number
; money received after battle = base money × level of highest-level enemy mon
ds 2
wMissableObjectCounter:: ; d047
ds 1
ds 1
wTrainerName:: ; d049
; 13 bytes for the letters of the opposing trainer
; the name is terminated with $50 with possible
; unused trailing letters
ds 13
wIsInBattle:: ; d056
; lost battle, this is -1
; no battle, this is 0
; wild battle, this is 1
; trainer battle, this is 2
ds 1
wPartyGainExpFlags:: ; d057
; flags that indicate which party members should be be given exp when GainExperience is called
flag_array 6
wCurOpponent:: ; d058
; in a wild battle, this is the species of pokemon
; in a trainer battle, this is the trainer class + 200
ds 1
wBattleType:: ; d059
; in normal battle, this is 0
; in old man battle, this is 1
; in safari battle, this is 2
ds 1
wDamageMultipliers:: ; d05a
; bits 0-6: Effectiveness
; $0 = immune
; $5 = not very effective
; $a = neutral
; $14 = super-effective
; bit 7: STAB
ds 1
wLoneAttackNo:: ; d05b
; which entry in LoneAttacks to use
wGymLeaderNo:: ; d05b
; it's actually the same thing as ^
ds 1
wTrainerNo:: ; d05c
; which instance of [youngster, lass, etc] is this?
ds 1
wCriticalHitOrOHKO:: ; d05d
; $00 = normal attack
; $01 = critical hit
; $02 = successful OHKO
; $ff = failed OHKO
ds 1
wMoveMissed:: ; d05e
ds 1
wPlayerStatsToDouble:: ; d05f
; always 0
ds 1
wPlayerStatsToHalve:: ; d060
; always 0
ds 1
wPlayerBattleStatus1:: ; d061
; bit 0 - bide
; bit 1 - thrash / petal dance
; bit 2 - attacking multiple times (e.g. double kick)
; bit 3 - flinch
; bit 4 - charging up for attack
; bit 5 - using multi-turn move (e.g. wrap)
; bit 6 - invulnerable to normal attack (using fly/dig)
; bit 7 - confusion
ds 1
wPlayerBattleStatus2:: ; d062
; bit 0 - X Accuracy effect
; bit 1 - protected by "mist"
; bit 2 - focus energy effect
; bit 4 - has a substitute
; bit 5 - need to recharge
; bit 6 - rage
; bit 7 - leech seeded
ds 1
wPlayerBattleStatus3:: ; d063
; bit 0 - toxic
; bit 1 - light screen
; bit 2 - reflect
; bit 3 - transformed
; maybe bit 4, weather, 5 spikes, 6 somethin' else?
ds 1
wEnemyStatsToDouble:: ; d064
; always 0
ds 1
wEnemyStatsToHalve:: ; d065
; always 0
ds 1
wEnemyBattleStatus1:: ; d066
ds 1
wEnemyBattleStatus2:: ; d067
ds 1
wEnemyBattleStatus3:: ; d068
ds 1
wPlayerNumAttacksLeft:: ; d069
; when the player is attacking multiple times, the number of attacks left
ds 1
wPlayerConfusedCounter:: ; d06a
ds 1
wPlayerToxicCounter:: ; d06b
ds 1
wPlayerDisabledMove:: ; d06c
; high nibble: which move is disabled (1-4)
; low nibble: disable turns left
ds 1
ds 1
wEnemyNumAttacksLeft:: ; d06e
; when the enemy is attacking multiple times, the number of attacks left
ds 1
wEnemyConfusedCounter:: ; d06f
ds 1
wEnemyToxicCounter:: ; d070
ds 1
wEnemyDisabledMove:: ; d071
; high nibble: which move is disabled (1-4)
; low nibble: disable turns left
ds 1
ds 1
wPlayerNumHits:: ; d073
; number of hits by player in attacks like Double Slap, etc.
wPlayerBideAccumulatedDamage:: ; d073
; the amount of damage accumulated by the player while biding (2 bytes)
wUnknownSerialCounter2:: ; d073
; 2 bytes
ds 4
wEscapedFromBattle:: ; d077
; non-zero when an item or move that allows escape from battle was used
ds 1
wAmountMoneyWon:: ; d078
; 3-byte BCD number
wObjectToHide:: ; d078
ds 1
wObjectToShow:: ; d079
ds 1
ds 1
wDefaultMap:: ; d07b
; the map you will start at when the debug bit is set
wMenuItemOffset:: ; d07b
wAnimationID:: ; d07b
; ID number of the current battle animation
ds 1
wNamingScreenType:: ; d07c
wPartyMenuTypeOrMessageID:: ; d07c
wTempTilesetNumTiles:: ; d07c
; temporary storage for the number of tiles in a tileset
ds 1
wSavedListScrollOffset:: ; d07d
; used by the pokemart code to save the existing value of wListScrollOffset
; so that it can be restored when the player is done with the pokemart NPC
ds 1
ds 2
; base coordinates of frame block
wBaseCoordX:: ; d080
ds 1
wBaseCoordY:: ; d081
ds 1
; low health alarm counter/enable
; high bit = enable, others = timer to cycle frequencies
wLowHealthAlarm:: ds 1 ; d082
wFBTileCounter:: ; d083
; counts how many tiles of the current frame block have been drawn
ds 1
wMovingBGTilesCounter2:: ; d084
ds 1
wSubAnimFrameDelay:: ; d085
; duration of each frame of the current subanimation in terms of screen refreshes
ds 1
wSubAnimCounter:: ; d086
; counts the number of subentries left in the current subanimation
ds 1
wSaveFileStatus:: ; d087
; 1 = no save file or save file is corrupted
; 2 = save file exists and no corruption has been detected
ds 1
wNumFBTiles:: ; d088
; number of tiles in current battle animation frame block
ds 1
wFlashScreenLongCounter:: ; d089
wSpiralBallsBaseY:: ; d089
wFallingObjectMovementByte:: ; d089
; bits 0-6: index into FallingObjects_DeltaXs array (0 - 8)
; bit 7: direction; 0 = right, 1 = left
wNumShootingBalls:: ; d089
wTradedMonMovingRight:: ; d089
; $01 if mon is moving from left gameboy to right gameboy; $00 if vice versa
wOptionsInitialized:: ; d089
wNewSlotMachineBallTile:: ; d089
wCoordAdjustmentAmount:: ; d089
; how much to add to the X/Y coord
wEnemyWentFirst::
wShinyMonFlag::
wTempLevel::
wUnusedD08A:: ; d089
ds 1
wSpiralBallsBaseX:: ; d08a
wNumFallingObjects:: ; d08a
wSlideMonDelay:: ; d08a
wAnimCounter:: ; d08a
; generic counter variable for various animations
wSubAnimTransform:: ; d08a
; controls what transformations are applied to the subanimation
; 01: flip horizontally and vertically
; 02: flip horizontally and translate downwards 40 pixels
; 03: translate base coordinates of frame blocks, but don't change their internal coordinates or flip their tiles
; 04: reverse the subanimation
ds 1
wEndBattleWinTextPointer:: ; d08b
ds 2
wEndBattleLoseTextPointer:: ; d08d
ds 2
ds 2
wEndBattleTextRomBank:: ; d091
ds 1
ds 1
wSubAnimAddrPtr:: ; d093
; the address _of the address_ of the current subanimation entry
ds 2
wSlotMachineAllowMatchesCounter:: ; d095
; If non-zero, the allow matches flag is always set.
; There is a 1/256 (~0.4%) chance that this value will be set to 60, which is
; the only way it can increase. Winning certain payout amounts will decrement it
; or zero it.
wSubAnimSubEntryAddr:: ; d095
; the address of the current subentry of the current subanimation
ds 2
ds 2
wOutwardSpiralTileMapPointer:: ; d099
ds 1
wPartyMenuAnimMonEnabled:: ; d09a
wTownMapSpriteBlinkingEnabled:: ; d09a
; non-zero when enabled. causes nest locations to blink on and off.
; the town selection cursor will blink regardless of what this value is
wUnusedD09B:: ; d09a
ds 1
wFBDestAddr:: ; d09b
; current destination address in OAM for frame blocks (big endian)
ds 2
wFBMode:: ; d09d
; controls how the frame blocks are put together to form frames
; specifically, after finishing drawing the frame block, the frame block's mode determines what happens
; 00: clean OAM buffer and delay
; 02: move onto the next frame block with no delay and no cleaning OAM buffer
; 03: delay, but don't clean OAM buffer
; 04: delay, without cleaning OAM buffer, and do not advance [wFBDestAddr], so that the next frame block will overwrite this one
ds 1
wLinkCableAnimBulgeToggle:: ; d09e
; 0 = small
; 1 = big
wIntroNidorinoBaseTile:: ; d09e
wOutwardSpiralCurrentDirection:: ; d09e
wDropletTile:: ; d09e
wNewTileBlockID:: ; d09e
wWhichBattleAnimTileset:: ; d09e
wSquishMonCurrentDirection:: ; d09e
; 0 = left
; 1 = right
wSlideMonUpBottomRowLeftTile:: ; d09e
; the tile ID of the leftmost tile in the bottom row in AnimationSlideMonUp_
ds 1
wDisableVBlankWYUpdate:: ds 1 ; if non-zero, don't update WY during V-blank ; d09f
wSpriteCurPosX:: ; d0a0
ds 1
wSpriteCurPosY:: ; d0a1
ds 1
wSpriteWidth:: ; d0a2
ds 1
wSpriteHeight:: ; d0a3
ds 1
wSpriteInputCurByte:: ; d0a4
; current input byte
ds 1
wSpriteInputBitCounter:: ; d0a5
; bit offset of last read input bit
ds 1
wSpriteOutputBitOffset:: ; d0a6; determines where in the output byte the two bits are placed. Each byte contains four columns (2bpp data)
; 3 -> XX000000 1st column
; 2 -> 00XX0000 2nd column
; 1 -> 0000XX00 3rd column
; 0 -> 000000XX 4th column
ds 1
wSpriteLoadFlags:: ; d0a7
; bit 0 determines used buffer (0 -> $a188, 1 -> $a310)
; bit 1 loading last sprite chunk? (there are at most 2 chunks per load operation)
ds 1
wSpriteUnpackMode:: ; d0a8
ds 1
wSpriteFlipped:: ; d0a9
ds 1
wSpriteInputPtr:: ; d0aa
; pointer to next input byte
ds 2
wSpriteOutputPtr:: ; d0ac
; pointer to current output byte
ds 2
wSpriteOutputPtrCached:: ; d0ae
; used to revert pointer for different bit offsets
ds 2
wSpriteDecodeTable0Ptr:: ; d0b0
; pointer to differential decoding table (assuming initial value 0)
ds 2
wSpriteDecodeTable1Ptr:: ; d0b2
; pointer to differential decoding table (assuming initial value 1)
ds 2
wd0b5:: ds 1 ; used as a temp storage area for Pokemon Species, and other Pokemon/Battle related things ; d0b4
wNameListType:: ; d0b5
ds 1
wPredefBank:: ; d0b6
ds 1
wMonHeader:: ; d0b7
wMonHIndex:: ; d0b7
; In the ROM base stats data stucture, this is the dex number, but it is
; overwritten with the internal index number after the header is copied to WRAM.
ds 1
wMonHBaseStats:: ; d0b8
wMonHBaseHP:: ; d0b8
ds 1
wMonHBaseAttack:: ; d0b9
ds 1
wMonHBaseDefense:: ; d0ba
ds 1
wMonHBaseSpeed:: ; d0bb
ds 1
wMonHBaseSpecial:: ; d0bc
ds 1
wMonHTypes:: ; d0bd
wMonHType1:: ; d0bd
ds 1
wMonHType2:: ; d0be
ds 1
wMonHCatchRate:: ; d0bf
ds 1
wMonHBaseEXP:: ; d0c0
ds 1
wMonHSpriteDim:: ; d0c1
ds 1
wMonHFrontSprite:: ; d0c2
ds 2
wMonHBackSprite:: ; d0c4
ds 2
wMonHMoves:: ; d0c6
ds 4
wMonHGrowthRate:: ; d0ca
ds 1
wMonHLearnset:: ; d0cb
; bit field
flag_array 50 + 5
wMonHPicBank:: ; d0d3
ds 1
wSavedTilesetType:: ; d0d3
; saved at the start of a battle and then written back at the end of the battle
ds 1
ds 2
wDamage:: ; d0d6
ds 2
ds 2
wRepelRemainingSteps:: ; d0da
ds 1
wMoves:: ; d0db
; list of moves for FormatMovesString
ds 4
wMoveNum:: ; d0df
ds 1
wMovesString:: ; d0e0
ds 56
wUnusedD119:: ; d118
ds 1
wWalkBikeSurfStateCopy:: ; d119
; wWalkBikeSurfState is sometimes copied here, but it doesn't seem to be used for anything
ds 1
wInitListType:: ; d11a
; the type of list for InitList to init
ds 1
wCapturedMonSpecies:: ; d11b
; 0 if no mon was captured
ds 1
wFirstMonsNotOutYet:: ; d11c
; Non-zero when the first player mon and enemy mon haven't been sent out yet.
; It prevents the game from asking if the player wants to choose another mon
; when the enemy sends out their first mon and suppresses the "no will to fight"
; message when the game searches for the first non-fainted mon in the party,
; which will be the first mon sent out.
ds 1
wPokeBallCaptureCalcTemp:: ; d11e
; lower nybble: number of shakes
; upper nybble: number of animations to play
wPokeBallAnimData:: ; d11d
wUsingPPUp:: ; d11d
wMaxPP:: ; d11d
; 0 for player, non-zero for enemy
wCalculateWhoseStats:: ; d11d
wTypeEffectiveness:: ; d11d
wMoveType:: ; d11d
wNumSetBits:: ; d11d
wd11e:: ds 1 ; used as a Pokemon and Item storage value. Also used as an output value for CountSetBits
wForcePlayerToChooseMon:: ; d11e
; When this value is non-zero, the player isn't allowed to exit the party menu
; by pressing B and not choosing a mon.
ds 1
wNumRunAttempts:: ; d11f
; number of times the player has tried to run from battle
ds 1
wEvolutionOccurred:: ; d120
ds 1
wVBlankSavedROMBank:: ; d121
ds 1
wFarCopyDataSavedROMBank:: ; d122
ds 1
wIsKeyItem:: ; d123
ds 1
wTextBoxID:: ; d124
ds 1
wCurrentMapScriptFlags:: ds 1 ; not exactly sure what this is used for, but it seems to be used as a multipurpose temp flag value ; d125
wCurEnemyLVL:: ; d126
ds 1
wItemListPointer:: ; d127
; pointer to list of items terminated by $FF
ds 2
wListCount:: ; d129
; number of entries in a list
ds 1
wLinkState:: ; d12a
ds 1
wTwoOptionMenuID:: ; d12b
ds 1
wChosenMenuItem:: ; d12c
; the id of the menu item the player ultimately chose
wOutOfBattleBlackout:: ; d12c
; non-zero when the whole party has fainted due to out-of-battle poison damage
ds 1
wMenuExitMethod:: ; d12d
; the way the user exited a menu
; for list menus and the buy/sell/quit menu:
; $01 = the user pressed A to choose a menu item
; $02 = the user pressed B to cancel
; for two-option menus:
; $01 = the user pressed A with the first menu item selected
; $02 = the user pressed B or pressed A with the second menu item selected
ds 1
wDungeonWarpDataEntrySize:: ; d12e
; the size is always 6, so they didn't need a variable in RAM for this
wWhichPewterGuy:: ; d12e
; 0 = museum guy
; 1 = gym guy
wWhichPrizeWindow:: ; d12e
; there are 3 windows, from 0 to 2
wGymGateTileBlock:: ; d12e
; a horizontal or vertical gate block
ds 1
wSavedSpriteScreenY:: ; d12f
ds 1
wSavedSpriteScreenX:: ; d130
ds 1
wSavedSpriteMapY:: ; d131
ds 1
wSavedSpriteMapX:: ; d132
ds 1
ds 5
wWhichPrize:: ; d138
ds 1
wIgnoreInputCounter:: ; d139
; counts downward each frame
; when it hits 0, bit 5 (ignore input bit) of wd730 is reset
ds 1
wStepCounter:: ; d13a
; counts down once every step
ds 1
wNumberOfNoRandomBattleStepsLeft:: ; d13b
; after a battle, you have at least 3 steps before a random battle can occur
ds 1
wPrize1:: ; d13c
ds 1
wPrize2:: ; d13d
ds 1
wPrize3:: ; d13e
ds 1
ds 1
wSerialRandomNumberListBlock:: ; d140
; the first 7 bytes are the preamble
wPrize1Price:: ; d140
ds 2
wPrize2Price:: ; d142
ds 2
wPrize3Price:: ; d144
ds 2
ds 1
wLinkBattleRandomNumberList:: ; d147
; shared list of 9 random numbers, indexed by wLinkBattleRandomNumberListIndex
ds 10
wSerialPlayerDataBlock:: ; d151
; the first 6 bytes are the preamble
wPseudoItemID:: ; d151
; When a real item is being used, this is 0.
; When a move is acting as an item, this is the ID of the item it's acting as.
; For example, out-of-battle Dig is executed using a fake Escape Rope item. In
; that case, this would be ESCAPE_ROPE.
ds 1
wUnusedD153:: ; d152
ds 1
ds 2
wEvoStoneItemID:: ; d155
ds 1
wSavedNPCMovementDirections2Index:: ; d156
ds 1
wPlayerName:: ; d157
ds NAME_LENGTH
wPartyDataStart::
wPartyCount:: ds 1 ; d162
wPartySpecies:: ds PARTY_LENGTH ; d163
wPartyEnd:: ds 1 ; d169
wPartyMons::
wPartyMon1:: party_struct wPartyMon1 ; d16a
wPartyMon2:: party_struct wPartyMon2 ; d196
wPartyMon3:: party_struct wPartyMon3 ; d1c2
wPartyMon4:: party_struct wPartyMon4 ; d1ee
wPartyMon5:: party_struct wPartyMon5 ; d21a
wPartyMon6:: party_struct wPartyMon6 ; d246
wPartyMonOT:: ds NAME_LENGTH * PARTY_LENGTH ; d272
wPartyMonNicks:: ds NAME_LENGTH * PARTY_LENGTH ; d2b4
wPartyMonNicksEnd::
wPartyDataEnd::
wMainDataStart::
wPokedexOwned:: ; d2f5
flag_array NUM_POKEMON
wPokedexOwnedEnd::
wPokedexSeen:: ; d309
flag_array NUM_POKEMON
wPokedexSeenEnd::
wNumBagItems:: ; d31c
ds 1
wBagItems:: ; d31d
; item, quantity
ds BAG_ITEM_CAPACITY * 2
ds 1 ; end
wPlayerMoney:: ; d346
ds 3 ; BCD
wRivalName:: ; d349
ds NAME_LENGTH
wOptions:: ; d354
; bit 7 = battle animation
; 0: On
; 1: Off
; bit 6 = battle style
; 0: Shift
; 1: Set
; bits 0-3 = text speed (number of frames to delay after printing a letter)
; 1: Fast
; 3: Medium
; 5: Slow
ds 1
wObtainedBadges:: ; d355
flag_array 8
ds 1
wLetterPrintingDelayFlags:: ; d357
; bit 0: If 0, limit the delay to 1 frame. Note that this has no effect if
; the delay has been disabled entirely through bit 1 of this variable
; or bit 6 of wd730.
; bit 1: If 0, no delay.
ds 1
wPlayerID:: ; d358
ds 2
wMapMusicSoundID:: ; d35a
ds 1
wMapMusicROMBank:: ; d35b
ds 1
wMapPalOffset:: ; d35c
; offset subtracted from FadePal4 to get the background and object palettes for the current map
; normally, it is 0. it is 6 when Flash is needed, causing FadePal2 to be used instead of FadePal4
ds 1
wCurMap:: ; d35d
ds 1
wCurrentTileBlockMapViewPointer:: ; d35e
; pointer to the upper left corner of the current view in the tile block map
ds 2
wYCoord:: ; d360
; player’s position on the current map
ds 1
wXCoord:: ; d361
ds 1
wYBlockCoord:: ; d362
; player's y position (by block)
ds 1
wXBlockCoord:: ; d363
ds 1
wLastMap:: ; d364
ds 1
wUnusedD366:: ; d365
ds 1
wCurMapTileset:: ; d366
ds 1
wCurMapHeight:: ; d367
; blocks
ds 1
wCurMapWidth:: ; d368
; blocks
ds 1
wMapDataPtr:: ; d369
ds 2
wMapTextPtr:: ; d36b
ds 2
wMapScriptPtr:: ; d36d
ds 2
wMapConnections:: ; d36f
; connection byte
ds 1
wMapConn1Ptr:: ; d370
ds 1
wNorthConnectionStripSrc:: ; d371
ds 2
wNorthConnectionStripDest:: ; d373
ds 2
wNorthConnectionStripWidth:: ; d375
ds 1
wNorthConnectedMapWidth:: ; d376
ds 1
wNorthConnectedMapYAlignment:: ; d377
ds 1
wNorthConnectedMapXAlignment:: ; d378
ds 1
wNorthConnectedMapViewPointer:: ; d379
ds 2
wMapConn2Ptr:: ; d37b
ds 1
wSouthConnectionStripSrc:: ; d37c
ds 2
wSouthConnectionStripDest:: ; d37e
ds 2
wSouthConnectionStripWidth:: ; d380
ds 1
wSouthConnectedMapWidth:: ; d381
ds 1
wSouthConnectedMapYAlignment:: ; d382
ds 1
wSouthConnectedMapXAlignment:: ; d383
ds 1
wSouthConnectedMapViewPointer:: ; d384
ds 2
wMapConn3Ptr:: ; d386
ds 1
wWestConnectionStripSrc:: ; d387
ds 2
wWestConnectionStripDest:: ; d389
ds 2
wWestConnectionStripHeight:: ; d38b
ds 1
wWestConnectedMapWidth:: ; d38c
ds 1
wWestConnectedMapYAlignment:: ; d38d
ds 1
wWestConnectedMapXAlignment:: ; d38e
ds 1
wWestConnectedMapViewPointer:: ; d38f
ds 2
wMapConn4Ptr:: ; d391
ds 1
wEastConnectionStripSrc:: ; d392
ds 2
wEastConnectionStripDest:: ; d394
ds 2
wEastConnectionStripHeight:: ; d396
ds 1
wEastConnectedMapWidth:: ; d397
ds 1
wEastConnectedMapYAlignment:: ; d398
ds 1
wEastConnectedMapXAlignment:: ; d399
ds 1
wEastConnectedMapViewPointer:: ; d39a
ds 2
wSpriteSet:: ; d39c
; sprite set for the current map (11 sprite picture ID's)
ds 11
wSpriteSetID:: ; d3a7
; sprite set ID for the current map
ds 1
wObjectDataPointerTemp:: ; d3a8
ds 2
ds 2
wMapBackgroundTile:: ; d3ac
; the tile shown outside the boundaries of the map
ds 1
wNumberOfWarps:: ; d3ad
; number of warps in current map
ds 1
wWarpEntries:: ; d3ae
; current map warp entries
ds 128
wDestinationWarpID:: ; d42e
; if $ff, the player's coordinates are not updated when entering the map
ds 1
wPikachuOverworldStateFlags:: ds 1 ; d42f
wPikachuSpawnState:: ds 1 ; d430
wd432:: ds 1 ; d431
wd433:: ds 1 ; d432
wd434:: ds 1 ; d433
wd435:: ds 1 ; d434
wd436:: ds 1 ; d435
wPikachuFollowCommandBufferSize:: ds 1 ; d436
wPikachuFollowCommandBuffer:: ds 16 ; d437
wExpressionNumber:: ; d447
ds 1
wPikaPicAnimNumber:: ; d448
ds 1
wPikachuMovementScriptBank:: ds 1 ; d449
wPikachuMovementScriptAddress:: dw ; d44a
wPikachuMovementFlags:: ; d44c
; bit 6 - spawn shadow
; bit 7 - signal end of command
ds 1
wCurPikaMovementData:: ; d44d
wCurPikaMovementParam1:: ds 1 ; d44d
wCurPikaMovementFunc1:: ds 1 ; d44e
wCurPikaMovementParam2:: ds 1 ; d44f
wCurPikaMovementFunc2:: ds 1 ; d450
wd451:: ds 1 ; d451
wCurPikaMovementSpriteImageIdx:: ds 1 ; d452
wPikaSpriteX:: ds 1 ; d453
wPikaSpriteY:: ds 1 ; d454
wPikachuMovementXOffset:: ds 1 ; d455
wPikachuMovementYOffset:: ds 1 ; d456
wPikachuStepTimer:: ds 1 ; d457
wPikachuStepSubtimer:: ds 1 ; d458
ds 5
wCurPikaMovementDataEnd:: ; d45e
ds wCurPikaMovementData - @
wPikaPicAnimPointer:: dw ; d44d
wPikaPicAnimPointerSetupFinished:: ds 1 ; d44f
wPikaPicAnimCurGraphicID:: ds 1 ; d450
wPikaPicAnimTimer:: ds 2 ; d451
wPikaPicAnimDelay:: ds 1 ; d453
wPikaPicPikaDrawStartX:: ds 1 ; d454
wPikaPicPikaDrawStartY:: ds 1 ; d455
wCurPikaPicAnimObject:: ; d456
wCurPikaPicAnimObjectVTileOffset:: db ; d456
wCurPikaPicAnimObjectXOffset:: db ; d457
wCurPikaPicAnimObjectYOffset:: db ; d458
wCurPikaPicAnimObjectScriptIdx:: db ; d459
wCurPikaPicAnimObjectFrameIdx:: db ; d45a
wCurPikaPicAnimObjectFrameTimer:: db ; d45b
ds 1
wCurPikaPicAnimObjectEnd:: ; d45d
ds 18
wPikachuHappiness:: ds 1 ; d46f
wPikachuMood:: ds 1 ; d470
wd472:: ds 1 ; d471
wd473:: ds 1 ; d472
ds 1
wd475:: ds 1 ; d474
ds 4
wd47a:: ds 1 ; d479
ds 24
wd492:: ds 1 ; d492
ds 1
wSurfingMinigameHiScore:: ds 2 ; 4-digit BCD little-endian
ds 1
wPrinterSettings:: ds 1
wUnknownSerialFlag_d499:: ds 1 ; d498
wPrinterConnectionOpen:: ds 1 ; d499
wPrinterOpcode:: ds 1 ; d49a
wd49c:: ds 1 ; d49b
ds 19
wNumSigns:: ; d4af
; number of signs in the current map (up to 16)
ds 1
wSignCoords:: ; d4b0
; 2 bytes each
; Y, X
ds 32
wSignTextIDs:: ; d4d0
ds 16
wNumSprites:: ; d4e0
; number of sprites on the current map
ds 1
; these two variables track the X and Y offset in blocks from the last special warp used
; they don't seem to be used for anything
wYOffsetSinceLastSpecialWarp:: ; d4e1
ds 1
wXOffsetSinceLastSpecialWarp:: ; d4e2
ds 1
wMapSpriteData:: ; d4e3
; two bytes per sprite (movement byte 2, text ID)
ds 32
wMapSpriteExtraData:: ; d503
; two bytes per sprite (trainer class/item ID, trainer set ID)
ds 32
wCurrentMapHeight2:: ; d523
; map height in 2x2 meta-tiles
ds 1
wCurrentMapWidth2:: ; d524
; map width in 2x2 meta-tiles
ds 1
wMapViewVRAMPointer:: ; d525
; the address of the upper left corner of the visible portion of the BG tile map in VRAM
ds 2
; In the comments for the player direction variables below, "moving" refers to
; both walking and changing facing direction without taking a step.
wPlayerMovingDirection:: ; d527
; if the player is moving, the current direction
; if the player is not moving, zero
; map scripts write to this in order to change the player's facing direction
ds 1
wPlayerLastStopDirection:: ; d528
; the direction in which the player was moving before the player last stopped
ds 1
wPlayerDirection:: ; d529
; if the player is moving, the current direction
; if the player is not moving, the last the direction in which the player moved
ds 1
wTilesetBank:: ; d52a
ds 1
wTilesetBlocksPtr:: ; d52b
; maps blocks (4x4 tiles) to tiles
ds 2
wTilesetGfxPtr:: ; d52d
ds 2
wTilesetCollisionPtr:: ; d52f
; list of all walkable tiles
ds 2
wTilesetTalkingOverTiles:: ; d531
ds 3
wGrassTile:: ; d534
ds 1
ds 4
wNumBoxItems:: ; d539
ds 1
wBoxItems:: ; d53a
; item, quantity
ds PC_ITEM_CAPACITY * 2
ds 1 ; end
wCurrentBoxNum:: ; d59f
; bits 0-6: box number
; bit 7: whether the player has changed boxes before
ds 2
wNumHoFTeams:: ; d5a1
; number of HOF teams
ds 1
wUnusedD5A3:: ; d5a2
ds 1
wPlayerCoins:: ; d5a3
ds 2 ; BCD
wMissableObjectFlags:: ; d5a5
; bit array of missable objects. set = removed
ds 32
wMissableObjectFlagsEnd:: ; d5c5
ds 7
wd5cd:: ds 1 ; temp copy of c1x2 (sprite facing/anim) ; d5cc
wMissableObjectList:: ; d5cd
; each entry consists of 2 bytes
; * the sprite ID (depending on the current map)
; * the missable object index (global, used for wMissableObjectFlags)
; terminated with $FF
ds 17 * 2
wGameProgressFlags:: ; d5e9
; $c8 bytes
wOaksLabCurScript:: ; d5e9
ds 1
wPalletTownCurScript:: ; d5f0
ds 1
ds 1
wBluesHouseCurScript:: ; d5f2
ds 1
wViridianCityCurScript:: ; d5f3
ds 1
ds 2
wPewterCityCurScript:: ; d5f6
ds 1
wRoute3CurScript:: ; d5f7
ds 1
wRoute4CurScript:: ; d5f8
ds 1
wFanClubCurScript:: ; d5f9
ds 1
wViridianGymCurScript:: ; d5fa
ds 1
wPewterGymCurScript:: ; d5fb
ds 1
wCeruleanGymCurScript:: ; d5fc
ds 1
wVermilionGymCurScript:: ; d5fd
ds 1
wCeladonGymCurScript:: ; d5fe
ds 1
wRoute6CurScript:: ; d5ff
ds 1
wRoute8CurScript:: ; d600
ds 1
wRoute24CurScript:: ; d601
ds 1
wRoute25CurScript:: ; d602
ds 1
wRoute9CurScript:: ; d603
ds 1
wRoute10CurScript:: ; d604
ds 1
wMtMoon1CurScript:: ; d605
ds 1
wMtMoon3CurScript:: ; d606
ds 1
wSSAnne8CurScript:: ; d607
ds 1
wSSAnne9CurScript:: ; d608
ds 1
wRoute22CurScript:: ; d609
ds 1
ds 1
wRedsHouse2CurScript:: ; d60b
ds 1
wViridianMarketCurScript:: ; d60c
ds 1
wRoute22GateCurScript:: ; d60d
ds 1
wCeruleanCityCurScript:: ; d60e
ds 1
ds 7
wSSAnne5CurScript:: ; d616
ds 1
wViridianForestCurScript:: ; d617
ds 1
wMuseum1FCurScript:: ; d618
ds 1
wRoute13CurScript:: ; d619
ds 1
wRoute14CurScript:: ; d61a
ds 1
wRoute17CurScript:: ; d61b
ds 1
wRoute19CurScript:: ; d61c
ds 1
wRoute21CurScript:: ; d61d
ds 1
wSafariZoneEntranceCurScript:: ; d61e
ds 1
wRockTunnel2CurScript:: ; d61f
ds 1
wRockTunnel1CurScript:: ; d620
ds 1
ds 1
wRoute11CurScript:: ; d622
ds 1
wRoute12CurScript:: ; d623
ds 1
wRoute15CurScript:: ; d624
ds 1
wRoute16CurScript:: ; d625
ds 1
wRoute18CurScript:: ; d626
ds 1
wRoute20CurScript:: ; d627
ds 1
wSSAnne10CurScript:: ; d628
ds 1
wVermilionCityCurScript:: ; d629
ds 1
wPokemonTower2CurScript:: ; d62a
ds 1
wPokemonTower3CurScript:: ; d62b
ds 1
wPokemonTower4CurScript:: ; d62c
ds 1
wPokemonTower5CurScript:: ; d62d
ds 1
wPokemonTower6CurScript:: ; d62e
ds 1
wPokemonTower7CurScript:: ; d62f
ds 1
wRocketHideout1CurScript:: ; d630
ds 1
wRocketHideout2CurScript:: ; d631
ds 1
wRocketHideout3CurScript:: ; d632
ds 1
wRocketHideout4CurScript:: ; d633
ds 2
wRoute6GateCurScript:: ; d635
ds 1
wRoute8GateCurScript:: ; d636
ds 2
wCinnabarIslandCurScript:: ; d638
ds 1
wMansion1CurScript:: ; d639
ds 2
wMansion2CurScript:: ; d63b
ds 1
wMansion3CurScript:: ; d63c
ds 1
wMansion4CurScript:: ; d63d
ds 1
wVictoryRoad2CurScript:: ; d63e
ds 1
wVictoryRoad3CurScript:: ; d63f
ds 1
wCeladonCityCurScript:: ; d640
ds 1
wFightingDojoCurScript:: ; d641
ds 1
wSilphCo2CurScript:: ; d642
ds 1
wSilphCo3CurScript:: ; d643
ds 1
wSilphCo4CurScript:: ; d644
ds 1
wSilphCo5CurScript:: ; d645
ds 1
wSilphCo6CurScript:: ; d646
ds 1
wSilphCo7CurScript:: ; d647
ds 1
wSilphCo8CurScript:: ; d648
ds 1
wSilphCo9CurScript:: ; d649
ds 1
wHallOfFameRoomCurScript:: ; d64a
ds 1
wGaryCurScript:: ; d64b
ds 1
wLoreleiCurScript:: ; d64c
ds 1
wBrunoCurScript:: ; d64d
ds 1
wAgathaCurScript:: ; d64e
ds 1
wUnknownDungeon3CurScript:: ; d64f
ds 1
wVictoryRoad1CurScript:: ; d650
ds 1
ds 1
wLanceCurScript:: ; d652
ds 1
ds 4
wSilphCo10CurScript:: ; d657
ds 1
wSilphCo11CurScript:: ; d658
ds 1
ds 1
wFuchsiaGymCurScript:: ; d65a
ds 1
wSaffronGymCurScript:: ; d65b
ds 1
ds 1
wCinnabarGymCurScript:: ; d65d
ds 1
wCeladonGameCornerCurScript:: ; d65e
ds 1
wRoute16GateCurScript:: ; d65f
ds 1
wBillsHouseCurScript:: ; d660
ds 1
wRoute5GateCurScript:: ; d661
ds 1
wPowerPlantCurScript:: ; d662
; overload
ds 0
wRoute7GateCurScript:: ; d662
; overload
ds 1
ds 1
wSSAnne2CurScript:: ; d664
ds 1
wSeafoamIslands4CurScript:: ; d665
ds 1
wRoute23CurScript:: ; d666
ds 1
wSeafoamIslands5CurScript:: ; d667
ds 1
wRoute18GateCurScript:: ; d668
ds 1
ds 78
wGameProgressFlagsEnd:: ; d6b7
ds 56
wObtainedHiddenItemsFlags:: ; d6ef
ds 14
wObtainedHiddenCoinsFlags:: ; d6fd
ds 2
wWalkBikeSurfState:: ; d6ff
; $00 = walking
; $01 = biking
; $02 = surfing
ds 1
ds 10
wTownVisitedFlag:: ; d70a
flag_array 13
wSafariSteps:: ; d70c
; starts at 502
ds 2
wFossilItem:: ; d70e
; item given to cinnabar lab
ds 1
wFossilMon:: ; d70f
; mon that will result from the item
ds 1
ds 2
wEnemyMonOrTrainerClass:: ; d712
; trainer classes start at 200
ds 1
wPlayerJumpingYScreenCoordsIndex:: ; d713
ds 1
wRivalStarter:: ; d714
ds 1
ds 1
wPlayerStarter:: ; d716
ds 1
wBoulderSpriteIndex:: ; d717
; sprite index of the boulder the player is trying to push
ds 1
wLastBlackoutMap:: ; d718
ds 1
wDestinationMap:: ; d719
; destination map (for certain types of special warps, not ordinary walking)
ds 1
wUnusedD71B:: ; d71a
ds 1
wTileInFrontOfBoulderAndBoulderCollisionResult:: ; d71b
; used to store the tile in front of the boulder when trying to push a boulder
; also used to store the result of the collision check ($ff for a collision and $00 for no collision)
ds 1
wDungeonWarpDestinationMap:: ; d71c
; destination map for dungeon warps
ds 1
wWhichDungeonWarp:: ; d71d
; which dungeon warp within the source map was used
ds 1
wUnusedD71F:: ; d71e
ds 1
ds 8
wd728:: ; d727
; bit 0: using Strength outside of battle
; bit 1: set by IsSurfingAllowed when surfing's allowed, but the caller resets it after checking the result
; bit 3: received Old Rod
; bit 4: received Good Rod
; bit 5: received Super Rod
; bit 6: gave one of the Saffron guards a drink
; bit 7: set by ItemUseCardKey, which is leftover code from a previous implementation of the Card Key
ds 1
ds 1
wBeatGymFlags:: ; d729
; redundant because it matches wObtainedBadges
; used to determine whether to show name on statue and in two NPC text scripts
ds 1
ds 1
wd72c:: ; d72b
; bit 0: if not set, the 3 minimum steps between random battles have passed
; bit 1: prevent audio fade out
ds 1
wd72d:: ; d72c
; This variable is used for temporary flags and as the destination map when
; warping to the Trade Center or Colosseum.
; bit 0: sprite facing directions have been initialised in the Trade Center
; bit 3: do scripted warp (used to warp back to Lavender Town from the top of the pokemon tower)
; bit 4: on a dungeon warp
; bit 5: don't make NPCs face the player when spoken to
; Bits 6 and 7 are set by scripts when starting major battles in the storyline,
; but they do not appear to affect anything. Bit 6 is reset after all battles
; and bit 7 is reset after trainer battles (but it's only set before trainer
; battles anyway).
ds 1
wd72e:: ; d72d
; bit 0: the player has received Lapras in the Silph Co. building
; bit 1: set in various places, but doesn't appear to have an effect
; bit 2: the player has healed pokemon at a pokemon center at least once
; bit 3: the player has a received a pokemon from Prof. Oak
; bit 4: disable battles
; bit 5: set when a battle ends and when the player blacks out in the overworld due to poison
; bit 6: using the link feature
; bit 7: set if scripted NPC movement has been initialised
ds 1
ds 1
wd730:: ; d72f
; bit 0: NPC sprite being moved by script
; bit 5: ignore joypad input
; bit 6: print text with no delay between each letter
; bit 7: set if joypad states are being simulated in the overworld or an NPC's movement is being scripted
ds 1
ds 1
wd732:: ; d731
; bit 0: play time being counted
; bit 1: remnant of debug mode? not set by the game code.
; if it is set
; 1. skips most of Prof. Oak's speech, and uses NINTEN as the player's name and SONY as the rival's name
; 2. does not have the player start in floor two of the playyer's house (instead sending them to [wLastMap])
; 3. allows wild battles to be avoided by holding down B
; bit 2: the target warp is a fly warp (bit 3 set or blacked out) or a dungeon warp (bit 4 set)
; bit 3: used warp pad, escape rope, dig, teleport, or fly, so the target warp is a "fly warp"
; bit 4: jumped into hole (Pokemon Mansion, Seafoam Islands, Victory Road) or went down waterfall (Seafoam Islands), so the target warp is a "dungeon warp"
; bit 5: currently being forced to ride bike (cycling road)
; bit 6: map destination is [wLastBlackoutMap] (usually the last used pokemon center, but could be the player's house)
ds 1
wFlags_D733:: ; d732
; bit 0: running a test battle
; bit 1: prevent music from changing when entering new map
; bit 2: skip the joypad check in CheckWarpsNoCollision (used for the forced warp down the waterfall in the Seafoam Islands)
; bit 3: trainer wants to battle
; bit 4: use variable [wCurMapScript] instead of the provided index for next frame's map script (used to start battle when talking to trainers)
; bit 7: used fly out of battle
ds 1
wBeatLorelei:: ; d733
; bit 1: set when you beat Lorelei and reset in Indigo Plateau lobby
; the game uses this to tell when Elite 4 events need to be reset
ds 1
wd735:: ; d734
ds 1
wd736:: ; d735
; bit 0: check if the player is standing on a door and make him walk down a step if so
; bit 1: the player is currently stepping down from a door
; bit 2: standing on a warp
; bit 6: jumping down a ledge / fishing animation
; bit 7: player sprite spinning due to spin tiles (Rocket hidehout / Viridian Gym)
ds 1
wCompletedInGameTradeFlags:: ; d736
ds 2
ds 2
wWarpedFromWhichWarp:: ; d73a
ds 1
wWarpedFromWhichMap:: ; d73b
ds 1
ds 2
wCardKeyDoorY:: ; d73e
ds 1
wCardKeyDoorX:: ; d73f
ds 1
ds 2
wFirstLockTrashCanIndex:: ; d742
ds 1
wSecondLockTrashCanIndex:: ; d743
ds 1
ds 2
wEventFlags:: ; d746
; below here are mostly in game flags
; d74b
; bit 0: Prof. Oak has lead the player to the north end of his lab
; bit 1: Prof. Oak has asked the player to choose a pokemon
; bit 2: the player and the rival have received their pokemon
; bit 3: the player has battled the rival in Oak's lab
; bit 4: Prof. Oak has given the player 5 pokeballs
; bit 5: received pokedex
flag_array NUM_EVENT_FLAGS
wLinkEnemyTrainerName:: ; d886
; linked game's trainer name
wGrassRate:: ; d886
ds 1
wGrassMons:: ; d887
; ds 20
ds 11
; Overload wGrassMons
wSerialEnemyDataBlock:: ; d892
ds 9
wEnemyPartyCount:: ds 1 ; d89b
wEnemyPartyMons:: ds PARTY_LENGTH + 1 ; d89c
wWaterRate:: db ; d8a3
wWaterMons:: db ; d8a4
ds wWaterRate - @
wEnemyMons:: ; d8a3
wEnemyMon1:: party_struct wEnemyMon1
wEnemyMon2:: party_struct wEnemyMon2
wEnemyMon3:: party_struct wEnemyMon3
wEnemyMon4:: party_struct wEnemyMon4
wEnemyMon5:: party_struct wEnemyMon5
wEnemyMon6:: party_struct wEnemyMon6
wEnemyMonOT:: ds NAME_LENGTH * PARTY_LENGTH ; d9ab
wEnemyMonNicks:: ds NAME_LENGTH * PARTY_LENGTH ; d9ed
wTrainerHeaderPtr:: ; da2f
ds 2
ds 6
wOpponentAfterWrongAnswer:: ; da37
; the trainer the player must face after getting a wrong answer in the Cinnabar
; gym quiz
wUnusedDA38:: ; da37
wPlayerGender::
ds 1
wCurMapScript:: ; da38
; index of current map script, mostly used as index for function pointer array
; mostly copied from map-specific map script pointer and wirtten back later
ds 1
ds 7
wPlayTimeHours:: ; da40
ds 1
wPlayTimeMaxed:: ; da41
ds 1
wPlayTimeMinutes:: ; da42
ds 1
wPlayTimeSeconds:: ; da43
ds 1
wPlayTimeFrames:: ; da44
ds 1
wSafariZoneGameOver:: ; da45
ds 1
wNumSafariBalls:: ; da46
ds 1
wDayCareInUse:: ; da47
; 0 if no pokemon is in the daycare
; 1 if pokemon is in the daycare
ds 1
wDayCareMonName:: ds NAME_LENGTH ; da48
wDayCareMonOT:: ds NAME_LENGTH ; da53
wDayCareMon:: box_struct wDayCareMon ; da5e
wMainDataEnd::
wBoxDataStart::
wNumInBox:: ds 1 ; da7f
wBoxSpecies:: ds MONS_PER_BOX + 1 ; da80
wBoxMons::
wBoxMon1:: box_struct wBoxMon1 ; da95
wBoxMon2:: ds box_struct_length * (MONS_PER_BOX + -1) ; dab6
wBoxMonOT:: ds NAME_LENGTH * MONS_PER_BOX ; dd29
wBoxMonNicks:: ds NAME_LENGTH * MONS_PER_BOX ; de05
wBoxMonNicksEnd:: ; dee1
wBoxDataEnd::
wGBCBasePalPointers:: ds NUM_ACTIVE_PALS * 2 ; dee1
wGBCPal:: ds PAL_SIZE ; dee9
wLastBGP:: ds 1 ; def1
wLastOBP0:: ds 1 ; def2
wLastOBP1:: ds 1 ; def3
wdef5:: ds 1 ; def4
wBGPPalsBuffer:: ds (NUM_ACTIVE_PALS + 1) * PAL_SIZE ; def5
SECTION "Stack", WRAMX[$dfff], BANK[1]
wStack:: ; dfff
ds -$100
INCLUDE "sram.asm"
| 21.071805 | 155 | 0.739876 | [
"Unlicense"
] | adhi-thirumala/EvoYellow | wram.asm | 76,011 | Assembly |
;==================================================================================================
; Settings and tables which the front-end may write
;==================================================================================================
; This is used to determine if and how the cosmetics can be patched
; It this moves then the version will no longer be valid, so it is important that this does not move
COSMETIC_CONTEXT:
COSMETIC_FORMAT_VERSION:
.word 0x1F073FC9
CFG_MAGIC_COLOR:
.halfword 0x0000, 0x00FF, 0x0000
CFG_HEART_COLOR:
.halfword 0x00FF, 0x0046, 0x0032
CFG_A_BUTTON_COLOR:
.halfword 0x005A, 0x005A, 0x00FF
CFG_B_BUTTON_COLOR:
.halfword 0x0000, 0x0096, 0x0000
CFG_C_BUTTON_COLOR:
.halfword 0x00FF, 0x00A0, 0x0000
CFG_TEXT_CURSOR_COLOR:
.halfword 0x0000, 0x0050, 0x00C8
CFG_SHOP_CURSOR_COLOR:
.halfword 0x0000, 0x0050, 0x00FF
CFG_A_NOTE_COLOR:
.halfword 0x0050, 0x0096, 0x00FF
CFG_C_NOTE_COLOR:
.halfword 0x00FF, 0x00FF, 0x0032
CFG_DISPLAY_DPAD:
.byte 0x01
CFG_RAINBOW_SWORD_INNER_ENABLED:
.byte 0x00
CFG_RAINBOW_SWORD_OUTER_ENABLED:
.byte 0x00
.align 4
; Initial Save Data table:
;
; This table describes what extra data should be written when a new save file is created. It must be terminated with
; four 0x00 bytes (which will happen by default as long as you don't fill the allotted space).
;
; Row format (4 bytes):
; AAAATTVV
; AAAA = Offset from the start of the save data
; TT = Type (0x00 = or value with current value, 0x01 = set the byte to the given value)
; VV = Value to write to the save
.area 0x400, 0
INITIAL_SAVE_DATA:
.endarea
.area 0x20, 0
EXTENDED_OBJECT_TABLE:
.endarea
BOMBCHUS_IN_LOGIC:
.word 0x00
RAINBOW_BRIDGE_CONDITION:
.word 0x00
; 0 = Open
; 1 = Medallions
; 2 = Dungeons
; 3 = Stones
; 4 = Vanilla
; 5 = Tokens
LACS_CONDITION:
.word 0x00
; 0 = Vanilla
; 1 = Medallions
; 2 = Dungeons
; 3 = Stones
GOSSIP_HINT_CONDITION:
.word 0x00
; 0 = Mask of Truth
; 1 = Stone of Agony
; 2 = No Requirements
FREE_SCARECROW_ENABLED:
.word 0x00
RAINBOW_BRIDGE_TOKENS:
.halfword 0x64
JABU_ELEVATOR_ENABLE:
.byte 0x00
OCARINAS_SHUFFLED:
.byte 0x00
FAST_CHESTS:
.byte 0x01
SHUFFLE_COWS:
.byte 0x00
SHUFFLE_BEANS:
.byte 0x00
DISABLE_TIMERS:
.byte 0x00
NO_FOG_STATE:
.byte 0x00
DUNGEONS_SHUFFLED:
.byte 0x00
OVERWORLD_SHUFFLED:
.byte 0x00
.align 4
| 21.277778 | 116 | 0.708877 | [
"MIT"
] | Aspeon/OoT-Randomizer | ASM/src/config.asm | 2,298 | Assembly |
SECTION code_clib
SECTION code_l_sdcc
PUBLIC ____sdcc_ll_push_hlix
PUBLIC ____sdcc_ll_push_hlix_0
____sdcc_ll_push_hlix:
IFDEF __SDCC_IX
push ix
pop de
ELSE
push iy
pop de
ENDIF
add hl,de
____sdcc_ll_push_hlix_0:
ex de,hl
ld hl,-6
add hl,sp
pop af
ld sp,hl
push af
push bc
ld hl,7+4
add hl,sp
ex de,hl
ld bc,7
lddr
ld a,(hl)
ld (de),a
pop bc
ret
| 9.16 | 30 | 0.59607 | [
"BSD-2-Clause"
] | ByteProject/Puddle-BuildTools | FictionTools/z88dk/libsrc/_DEVELOPMENT/l/sdcc/____sdcc_ll_push_hlix.asm | 458 | Assembly |
<%
from pwnlib.shellcraft.i386.linux import syscall
%>
<%page args="fd, addr, length"/>
<%docstring>
Invokes the syscall bind. See 'man 2 bind' for more information.
Arguments:
fd(int): fd
addr(CONST_SOCKADDR_ARG): addr
len(socklen_t): len
</%docstring>
${syscall('SYS_bind', fd, addr, length)}
| 21.2 | 65 | 0.672956 | [
"MIT"
] | IMULMUL/python3-pwntools | pwnlib/shellcraft/templates/i386/android/bind.asm | 318 | Assembly |
;
; System Call for REX6000
;
; $Id: DbGetRecordCount.asm,v 1.5 2017-01-03 00:11:31 aralbrec Exp $
;
; extern unsigned long DbGetRecordCount( int );
;
; Written by Damjan Marion <dmarion@open.hr>
PUBLIC DbGetRecordCount
PUBLIC _DbGetRecordCount
.DbGetRecordCount
._DbGetRecordCount
pop ix
pop hl
push hl
push ix
ld de,$00ee ;DB_GETRECORDCOUNT
ld ($c000),de
ld ($c002),hl ; param 1
ld hl,0
push hl
push hl
add hl,sp
ld ($c004),hl ; param 2, ptr to long
rst $10
pop hl
pop de
ret
| 17.181818 | 68 | 0.620811 | [
"BSD-2-Clause"
] | ByteProject/Puddle-BuildTools | FictionTools/z88dk/libsrc/target/rex/DbGetRecordCount.asm | 567 | Assembly |
/*
* example0: simple move, add
* r3 = 100 + 200
*/
mov r1, 100
mov r2, 200
add r3, r1, r2
halt
| 8.916667 | 29 | 0.542056 | [
"BSD-3-Clause"
] | takenobu-hs/processor-creative-kit | examples/test0.asm | 107 | Assembly |
.inesprg 1 ;1x 16kb PRG code
.ineschr 1 ;1x 8kb CHR data
.inesmap 0 ; mapper 0 = NROM, no bank swapping
.inesmir 1 ;background mirroring (vertical mirroring = horizontal scrolling)
.rsset $0000
joypad1 .rs 1 ;button states for the current frame
joypad1_old .rs 1 ;last frame's button states
joypad1_pressed .rs 1 ;current frame's off_to_on transitions
current_noise .rs 1 ;used to index into our note_table
noi_volumereg .rs 1 ;used to update volume register of noise channel
noi_lencountbit .rs 1 ;state of bit 5 of the noise volume register ($400C)
noi_envdecaybit .rs 1 ;state of bit 4 of the noise volume register ($400C)
sleeping .rs 1 ;main program sets this and waits for the NMI to clear it. Ensures the main program is run only once per frame.
; for more information, see Disch's document: URL HERE
ptr1 .rs 2 ;a pointer
y_mod .rs 1 ;used for mod function
;----- first 8k bank of PRG-ROM
.bank 0
.org $C000
irq:
NMI:
pha ;backup registers
txa
pha
tya
pha
; draw text to screen
jsr draw_rngtext
jsr draw_freqtext
jsr draw_bitstext
lda #$00 ;set scroll
sta $2005
sta $2005
lda #$00
sta sleeping ;wake up the main program
pla ;restore registers
tay
pla
tax
pla
rti
RESET:
sei
cld
ldx #$FF
txs
inx
vblankwait1:
bit $2002
bpl vblankwait1
clearmem:
lda #$00
sta $0000, x
sta $0100, x
sta $0300, x
sta $0400, x
sta $0500, x
sta $0600, x
sta $0700, x
lda #$FE
sta $0200, x
inx
bne clearmem
vblankwait2:
bit $2002
bpl vblankwait2
;set a couple palette colors. This demo only uses two
lda $2002 ;reset PPU HI/LO latch
lda #$3F
sta $2006
lda #$00
sta $2006 ;palette data starts at $3F00
lda #$0F ;black
sta $2007
lda #$30 ;white
sta $2007
;Enable sound channels
lda #%00001000
sta $4015 ;enable Noise
lda #$00
sta current_noise ;start with first noise
lda #$01
sta noi_lencountbit ; start with LC disabled
sta noi_envdecaybit ; start with ED disabled
lda #$88
sta $2000 ;enable NMIs
lda #$18
sta $2001 ;turn PPU on
;main program starts here
forever:
inc sleeping ;go to sleep (wait for NMI).
.loop:
lda sleeping
bne .loop ;wait for NMI to clear the sleeping flag and wake us up
;when NMI wakes us up, handle input and go back to sleep
jsr read_joypad
jsr handle_input
jmp forever ;go back to sleep
;----------------------------
; read_joypad will capture the current button state and store it in joypad1.
; Off-to-on transitions will be stored in joypad1_pressed
read_joypad:
lda joypad1
sta joypad1_old ;save last frame's joypad button states
lda #$01
sta $4016
lda #$00
sta $4016
ldx #$08
.loop:
lda $4016
lsr a
rol joypad1 ;A, B, select, start, up, down, left, right
dex
bne .loop
lda joypad1_old ;what was pressed last frame.
eor #%11111111 ;EOR to flip all the bits to find what was not pressed last frame
;;;eor #%11110111
; we ignore up button here. we want to let up button continue to retrigger noise sample, otherwise it will only play once per btn press.
and joypad1 ;what is pressed this frame
sta joypad1_pressed ;stores off-to-on transitions
rts
;---------------------
; handle_input will perform actions based on input:
; up - play current note
; down - stop playing the note
; left - cycle down a note
; right - cycle up a note
handle_input:
lda joypad1_pressed
and #%11001111 ;check d-pad and a, b only
beq .done
.check_up:
and #$08 ;up
beq .check_down
jsr play_note
.check_down:
lda joypad1_pressed
and #$04 ;down
beq .check_left
jsr silence_note
.check_left:
lda joypad1_pressed
and #$02 ;left
beq .check_right
jsr note_down
.check_right:
lda joypad1_pressed
and #$01 ;right
beq .check_a
jsr note_up
.check_a:
lda joypad1_pressed
and #$80 ;a
beq .check_b
lda noi_lencountbit ; flip bit
eor #$01
sta noi_lencountbit
.check_b:
lda joypad1_pressed
and #$40 ;b
beq .done
lda noi_envdecaybit ; flip bit
eor #$01
sta noi_envdecaybit
.done:
rts
;----------------------
; play_note plays the noise stored in current_noise
play_note:
lda #%00001111 ; full volume
sta noi_volumereg ; reset volume register
lda noi_lencountbit ; check if we should set length counter
asl a
asl a
asl a
asl a
asl a ; shift value in variable left 5 times to match it to bit 5
ora noi_volumereg ; OR it with our volume to add the 1 if it's there
sta noi_volumereg
lda noi_envdecaybit ; check if we should set envelope decay
asl a
asl a
asl a
asl a ; shift value in variable left 4 times to match it to bit 4
ora noi_volumereg ; OR it with our volume to add the 1 if it's there
sta noi_volumereg
sta $400C ; write final volume byte to register
lda current_noise
asl a ;multiply by 2 because we are indexing into a table of words
tay
lda noise_values, y ;read the low byte of the "period"
sta $400E ;write to "NOI_LO"
lda noise_values+1, y ;read the high byte of the "period"
sta $400F ;write to "NOI_HI" (notes in table are made to fit noise registers)
rts
;--------------------
; silence_note silences the noise channel
silence_note:
lda #$30
sta $400C ;silence Noise by setting the volume to 0.
rts
;--------------------
; note_down will move current_noise down. Lowest noise will wrap to highest noise
note_down:
dec current_noise
lda current_noise
cmp #$FF
bne .done
lda #$1F ;highest noise. We wrapped from 0
sta current_noise
.done:
rts
;----------------------
; note_up will move current_noise up. Highest noise will wrap to lowest noise
note_up:
inc current_noise
lda current_noise
cmp #$20 ;did we move past the highest noise value?
bne .done ;if not, no problem
lda #$00 ;but if we did, wrap around to 0 (the lowest noise)
sta current_noise
.done:
rts
;-------------
; draw_rngtext will draw the rng mode
; this subroutine writes to the PPU registers, so it should only be run during vblank (ie, in NMI)
draw_rngtext:
lda $2002
lda #$21
sta $2006
lda #$4A
sta $2006 ;$214D is a nice place in the middle of the screen to draw
lda current_noise ;use current_noise (0-31) as an index into our pointer table
cmp #$10
bcc .rng0
lda #$01 ; if current_noise >= 16, set rng mode to 1
jmp .rng1
.rng0:
lda #$00 ; set rng mode to 0 as default
.rng1:
asl a ;multiply by 2 because we are indexing into a table of pointers (which are words)
tay
lda text_rng_pointers, y ;setup pointer to the text data
sta ptr1
lda text_rng_pointers+1, y
sta ptr1+1
ldy #$00
.loop:
lda [ptr1], y ;read a byte from the string
bmi .end ;if negative, we are finished (our strings are terminated by $FF, a negative number)
sta $2007 ;else draw on the screen
iny
jmp .loop
.end:
rts
;-------------
; draw_freqtext will draw the frequency of the noise
; this subroutine writes to the PPU registers, so it should only be run during vblank (ie, in NMI)
draw_freqtext:
lda $2002
lda #$21
sta $2006
lda #$8A
sta $2006 ;$214D is a nice place in the middle of the screen to draw
lda current_noise ;use current_noise (0-31) as an index to freq. text
ldy #$10
jsr mod ; mod by 16 to get a number in 0-15 (in case we're in rng mode 1)
asl a ;multiply by 2 because we are indexing into a table of pointers (which are words)
tay
lda text_freq_pointers, y ;setup pointer to the text data
sta ptr1
lda text_freq_pointers+1, y
sta ptr1+1
ldy #$00
.loop:
lda [ptr1], y ;read a byte from the string
bmi .end ;if negative, we are finished (our strings are terminated by $FF, a negative number)
sta $2007 ;else draw on the screen
iny
jmp .loop
.end:
rts
;-------------
; draw_bitstext will draw the states of the length counter and env decay bits (4 and 5)
; this subroutine writes to the PPU registers, so it should only be run during vblank (ie, in NMI)
draw_bitstext:
; Draw bit 5 text
lda $2002
lda #$22
sta $2006
lda #$0A
sta $2006 ;$214D is a nice place in the middle of the screen to draw
lda noi_lencountbit ;use noi_lencountbit (0/1) as an index into our pointer table
asl a ;multiply by 2 because we are indexing into a table of pointers (which are words)
tay
lda text_bit5_pointers, y ;setup pointer to the text data
sta ptr1
lda text_bit5_pointers+1, y
sta ptr1+1
ldy #$00
.loopA:
lda [ptr1], y ;read a byte from the string
bmi .endA ;if negative, we are finished (our strings are terminated by $FF, a negative number)
sta $2007 ;else draw on the screen
iny
jmp .loopA
.endA:
; Draw bit 4 text
lda $2002
lda #$22
sta $2006
lda #$4A
sta $2006 ;$214D is a nice place in the middle of the screen to draw
lda noi_envdecaybit ;use noi_envdecaybit (0/1) as an index into our pointer table
asl a ;multiply by 2 because we are indexing into a table of pointers (which are words)
tay
lda text_bit4_pointers, y ;setup pointer to the text data
sta ptr1
lda text_bit4_pointers+1, y
sta ptr1+1
ldy #$00
.loopB:
lda [ptr1], y ;read a byte from the string
bmi .endB ;if negative, we are finished (our strings are terminated by $FF, a negative number)
sta $2007 ;else draw on the screen
iny
jmp .loopB
.endB:
rts
; Modulo operator.
; Load A and Y prior to calling. Returns A%Y in A.
mod:
SEC ; set carry (C=1) to clear borrow
STY y_mod ; store Y in memory address y_mod
modloop:
SBC y_mod ; subtract A - Y
BCS modloop ; loops if subtraction DID NOT produce a borrow (C=1)
ADC y_mod ; add Y back to A to get last positive modulus
RTS
;----- second 8k bank of PRG-ROM
.bank 1
.org $E000
.include "se_note_table.i" ;our NTSC note lookup table
noise_values:
; Noise frequencies, RNG Mode 0 ($5F - $6E)
.dw $0000, $0001, $0002, $0003, $0004, $0005, $0006, $0007, $0008, $0009, $000A, $000B, $000C, $000D, $000E, $000F
; Noise frequencies, RNG Mode 1 ($6F - $7E)
.dw $0080, $0081, $0082, $0083, $0084, $0085, $0086, $0087, $0088, $0089, $008A, $008B, $008C, $008D, $008E, $008F
;this is a table of pointers. These pointers point to the beginning of text strings.
text_rng_pointers:
.word text_RNGMode0, text_RNGMode1
text_freq_pointers:
.word (text_Freq+(9*0)), (text_Freq+(9*1)), (text_Freq+(9*2)), (text_Freq+(9*3))
.word (text_Freq+(9*4)), (text_Freq+(9*5)), (text_Freq+(9*6)), (text_Freq+(9*7))
.word (text_Freq+(9*8)), (text_Freq+(9*9)), (text_Freq+(9*10)), (text_Freq+(9*11))
.word (text_Freq+(9*12)), (text_Freq+(9*13)), (text_Freq+(9*14)), (text_Freq+(9*15))
text_bit5_pointers:
.word text_LC_0, text_LC_1
text_bit4_pointers:
.word text_ED_0, text_ED_1
;CHR
; $00 = blank
; $0A = "#"
; $10-$16 = "A"- "G"
text_Freq: ; start of frequency text strings (Freq. 0-15)
.byte $15, $21, $14, $20, $0F, $00, $00, $1E, $FF
.byte $15, $21, $14, $20, $0F, $00, $00, $01, $FF
.byte $15, $21, $14, $20, $0F, $00, $00, $02, $FF
.byte $15, $21, $14, $20, $0F, $00, $00, $03, $FF
.byte $15, $21, $14, $20, $0F, $00, $00, $04, $FF
.byte $15, $21, $14, $20, $0F, $00, $00, $05, $FF
.byte $15, $21, $14, $20, $0F, $00, $00, $06, $FF
.byte $15, $21, $14, $20, $0F, $00, $00, $07, $FF
.byte $15, $21, $14, $20, $0F, $00, $00, $08, $FF
.byte $15, $21, $14, $20, $0F, $00, $00, $09, $FF
.byte $15, $21, $14, $20, $0F, $00, $01, $1E, $FF
.byte $15, $21, $14, $20, $0F, $00, $01, $01, $FF
.byte $15, $21, $14, $20, $0F, $00, $01, $02, $FF
.byte $15, $21, $14, $20, $0F, $00, $01, $03, $FF
.byte $15, $21, $14, $20, $0F, $00, $01, $04, $FF
.byte $15, $21, $14, $20, $0F, $00, $01, $05, $FF
text_RNGMode0:
.byte $21, $1D, $16, $00, $1C, $1E, $13, $14, $0D, $00, $1E, $FF
text_RNGMode1:
.byte $21, $1D, $16, $00, $1C, $1E, $13, $14, $0D, $00, $01, $FF
text_LC_0:
.byte $1B, $12, $0D, $00, $1E, $FF
text_LC_1:
.byte $1B, $12, $0D, $00, $01, $FF
text_ED_0:
.byte $14, $13, $0D, $00, $1E, $FF
text_ED_1:
.byte $14, $13, $0D, $00, $01, $FF
;---- vectors
.org $FFFA ;first of the three vectors starts here
.dw NMI ;when an NMI happens (once per frame if enabled) the
;processor will jump to the label NMI:
.dw RESET ;when the processor first turns on or is reset, it will jump
;to the label RESET:
.dw irq ;external interrupt IRQ is not used in this tutorial
;------ 8k chr bank
.bank 2
.org $0000
.incbin "NES_APUTest.chr" | 27.810811 | 138 | 0.612245 | [
"MIT"
] | tragicmuffin/nes-tests | players/src/NES_APUTest_NoisePlayer.asm | 13,377 | Assembly |
; * = width | BC | D | HL | IXL|IYL | IXH|IYH | Preserves
;----------------------------------------------+-----------+-----+-------------+---------+----------+--------------------------
; draw_tile[_with_mask]_* | cy,cx | | sprite_addr | height | | (IXH, IY)|(IX, IYH), ALL'
; draw_tile[_with_mask]_*_at_addr | dst_addr | | sprite_addr | height | B&~7 | (IXH, IY)|(IX, IYH), ALL'
; draw_preshifted_sprite[_with_mask]_* | cy,cx | dy | sprite_addr | height | | IY|IX, ALL'
; draw_preshifted_sprite[_with_mask]_*_at_addr | dst_addr | dy | sprite_addr | height | B&~7 | IY|IX, ALL'
;----------------------------------------------+-----------+-----+-------------+---------+----------+--------------------------
; where (cx,cy) - character coords and dy - offset inside character (0-7).
; * = width | code size | data size | time (+[dT + [dT]] - time to cross screen 1/3 and 2/3)
;--------------------------------------------+-----------------------+-----------+-------------------------------------------------------
; draw_tile_*_at_addr | 36 + 20*width | | 61 + 36*height + 128*width*height + [29 + [29]]
; draw_tile_* | +14 | | +54
; draw_tile_with_mask_*_at_addr | 36 + 48*width | | 61 + 36*height + 288*width*height + [29 + [29]]
; draw_tile_with_mask_* | +14 | | +54
; draw_preshifted_sprite_*_at_addr | 65 + 20*width + | 16 | 250 + 70*height + 128*width*height + [39 + [39]] +
; | + {16 once for all} + | | + [(5 + height) if width > 5]
; | + [2 if width > 5] | |
; draw_preshifted_sprite_* | +17 | | +66
; draw_preshifted_sprite_with_mask_*_at_addr | 50 + 48*width + | 16 | 205 + 51*height + 288*width*height + [43 + [43]]
; | + {18 once for all} | |
; draw_preshifted_sprite_with_mask_* | +17 | | +66
IFNDEF PRESERVE_IX
DEFINE IZ! IX
DEFINE IZL! IXL
DEFINE IZH! IXH
DEFINE IZ_PREFIX! #DD ; IX opcodes prefix
ELSE
DEFINE IZ! IY
DEFINE IZL! IYL
DEFINE IZH! IYH
DEFINE IZ_PREFIX! #FD ; IY opcodes prefix
ENDIF
; Size = 5
; Time = 32
MACRO _init_tile_read
LD E,(HL)
INC HL
LD D,(HL)
INC HL
LD SP,HL
ENDM
; Size = 2.5*width - 1 + [+/-0.5]
; Time = 16*width - 4 + [+/-5]
MACRO _draw_line_into_HL WIDTH, DIR
.i = 0
DUP WIDTH
IF (.i%2) == ((DIR<0) & (WIDTH%2))
POP DE
LD (HL),E
ELSE
LD (HL),D
ENDIF
IF .i != (WIDTH-1)
if_then_else DIR>0, INC L, DEC L
ENDIF
.i = .i+1
EDUP
ENDM
; Size = 6*width - 1
; Time = 36*width - 4
MACRO _draw_line_with_mask_into_BC WIDTH, DIR
.i = 0
DUP WIDTH
POP DE
LD A,(BC)
AND D
OR E
LD (BC),A
IF .i != (WIDTH-1)
if_then_else DIR>0, INC C, DEC C
ENDIF
.i = .i+1
EDUP
ENDM
; Size = 36 + 20*width
; Time = 61 + 36*height + 128*width*height + [29 + [29]]
MACRO _draw_tile WIDTH
LD (.old_sp),SP
_init_tile_read
LD H,B
LD L,C
LD C,IZL!
CP 0
ORG $-1
.loop
_draw_line_into_HL WIDTH, +1
INC H
_draw_line_into_HL WIDTH, -1
INC H
_draw_line_into_HL WIDTH, +1
INC H
_draw_line_into_HL WIDTH, -1
INC H
_draw_line_into_HL WIDTH, +1
INC H
_draw_line_into_HL WIDTH, -1
INC H
_draw_line_into_HL WIDTH, +1
INC H
_draw_line_into_HL WIDTH, -1
DEC C
JR Z,.break
; H -= 7
; L += 32
LD H,B
LD A,L
ADD 32
LD L,A
JP NC,.loop
; H += 8
LD A,H
ADD 8
LD H,A
LD B,H
JP .loop
.break
LD SP,0
.old_sp EQU $-2
RET
ENDM
; Size = 36 + 48*width
; Time = 61 + 36*height + 288*width*height + [29 + [29]]
MACRO _draw_tile_with_mask WIDTH
LD (.old_sp),SP
_init_tile_read
LD H,B
LD A,IZL!
LD L,A
CP 0
ORG $-1
.loop
_draw_line_with_mask_into_BC WIDTH, +1
INC B
_draw_line_with_mask_into_BC WIDTH, -1
INC B
_draw_line_with_mask_into_BC WIDTH, +1
INC B
_draw_line_with_mask_into_BC WIDTH, -1
INC B
_draw_line_with_mask_into_BC WIDTH, +1
INC B
_draw_line_with_mask_into_BC WIDTH, -1
INC B
_draw_line_with_mask_into_BC WIDTH, +1
INC B
_draw_line_with_mask_into_BC WIDTH, -1
DEC L
JR Z,.break
; B -= 7
; C += 32
LD B,H
LD A,C
ADD 32
LD C,A
JP NC,.loop
; B += 8
LD A,B
ADD 8
LD B,A
LD H,B
JP .loop
.break
LD SP,0
.old_sp EQU $-2
RET
ENDM
; Size = 16
; Time = 29 + [39]
_draw_sprite_HL_next_char
IFUSED
; H -= 7
; L += 32
LD H,C
LD A,L
ADD 32
LD L,A
.exit JP NC,0
.ret_addr EQU $-2
; H += 8
LD A,H
ADD 8
LD H,A
LD C,H
JP .exit
ENDIF
; Size = 18
; Time = 33 + [43]
_draw_sprite_BC_next_char
IFUSED
; B -= 7
; C += 32
LD B,IZH!
LD A,C
ADD 32
LD C,A
.exit JP NC,0
.ret_addr EQU $-2
; B += 8
LD A,B
ADD 8
LD B,A
LD IZH!,B
JP .exit
ENDIF
; Size = 65 + 20*width + [2 if width > 5] + {16 for patch table} + {16 once for all}
; Time = 250 + 70*height + 128*width*height + [(5 + height) if width > 5] + [39 + [39]]
MACRO _draw_preshifted_sprite WIDTH
DEFINE PROC_NAME! draw_preshifted_sprite_WIDTH
LD A,D
ADD A
JP Z,draw_tile_WIDTH_at_addr
LD (.old_sp),SP
_init_tile_read
LD HL,_PROC_NAME!_table ; defined separately
ADD L
LD L,A
LD A,(HL)
INC L
LD H,(HL)
LD L,A
LD (.restore_addr),HL
LD (HL),IZ_PREFIX!
INC HL
LD (HL),#E9 ; JP (IX|IY)
INC HL
LD (_draw_sprite_HL_next_char.ret_addr),HL
LD H,B
LD L,C
LD B,IZL!
LD C,IZH!
LD IZ!,_draw_sprite_HL_next_char
CP 0
ORG $-1
.loop
_draw_line_into_HL WIDTH, +1
_PROC_NAME!_patch_1 INC H : NOP
_draw_line_into_HL WIDTH, -1
_PROC_NAME!_patch_2 INC H : NOP
_draw_line_into_HL WIDTH, +1
_PROC_NAME!_patch_3 INC H : NOP
_draw_line_into_HL WIDTH, -1
_PROC_NAME!_patch_4 INC H : NOP
_draw_line_into_HL WIDTH, +1
_PROC_NAME!_patch_5 INC H : NOP
_draw_line_into_HL WIDTH, -1
_PROC_NAME!_patch_6 INC H : NOP
_draw_line_into_HL WIDTH, +1
_PROC_NAME!_patch_7 INC H : NOP
_draw_line_into_HL WIDTH, -1
INC H
IF WIDTH <= 5
DJNZ .loop
ELSE
DEC B
JP NZ,.loop
ENDIF
.break
LD HL,#0024 ; INC H : NOP
LD (0),HL
.restore_addr EQU $-2
LD SP,0
.old_sp EQU $-2
RET
UNDEFINE PROC_NAME!
ENDM
; Size = 50 + 48*width + {16 for patch table} + {18 once for all}
; Time = 205 + 51*height + 288*width*height + [43 + [43]]
MACRO _draw_preshifted_sprite_with_mask WIDTH
DEFINE PROC_NAME! draw_preshifted_sprite_with_mask_WIDTH
LD A,D
ADD A
JP Z,draw_tile_with_mask_WIDTH_at_addr
LD (.old_sp),SP
_init_tile_read
LD HL,_PROC_NAME!_table ; defined separately
ADD L
LD L,A
LD A,(HL)
INC L
LD H,(HL)
LD L,A
LD (.restore_addr),HL
LD (HL),#E9 ; JP (HL)
INC HL
LD (_draw_sprite_BC_next_char.ret_addr),HL
LD HL,_draw_sprite_BC_next_char
CP 0
ORG $-1
.loop
_draw_line_with_mask_into_BC WIDTH, +1
_PROC_NAME!_patch_1 INC B
_draw_line_with_mask_into_BC WIDTH, -1
_PROC_NAME!_patch_2 INC B
_draw_line_with_mask_into_BC WIDTH, +1
_PROC_NAME!_patch_3 INC B
_draw_line_with_mask_into_BC WIDTH, -1
_PROC_NAME!_patch_4 INC B
_draw_line_with_mask_into_BC WIDTH, +1
_PROC_NAME!_patch_5 INC B
_draw_line_with_mask_into_BC WIDTH, -1
_PROC_NAME!_patch_6 INC B
_draw_line_with_mask_into_BC WIDTH, +1
_PROC_NAME!_patch_7 INC B
_draw_line_with_mask_into_BC WIDTH, -1
INC B
DEC IZL!
JP NZ,.loop
.break
LD A,#04 ; INC B
LD (0),A
.restore_addr EQU $-2
LD SP,0
.old_sp EQU $-2
RET
UNDEFINE PROC_NAME!
ENDM
MACRO _define_draw_proc TYPE, WIDTH
DEFINE DRAW_PROC_NAME! draw_TYPE_WIDTH
IFUSED DRAW_PROC_NAME!
DRAW_PROC_NAME! _get_TYPE_screen_addr
; fake call to mark label as used
JP DRAW_PROC_NAME!_at_addr
ORG $-3
ENDIF
IFUSED DRAW_PROC_NAME!_at_addr
DRAW_PROC_NAME!_at_addr _draw_TYPE WIDTH
ENDIF
UNDEFINE DRAW_PROC_NAME!
ENDM
DEFINE _get_tile_screen_addr get_screen_char_addr_inline
DEFINE _get_tile_with_mask_screen_addr get_screen_char_addr_inline
DEFINE _get_preshifted_sprite_screen_addr get_screen_byte_addr_inline
DEFINE _get_preshifted_sprite_with_mask_screen_addr get_screen_byte_addr_inline
_i = 1
DUP 32
_define_draw_proc tile, NUMBERS[_i]
_define_draw_proc tile_with_mask, NUMBERS[_i]
_define_draw_proc preshifted_sprite, NUMBERS[_i]
_define_draw_proc preshifted_sprite_with_mask, NUMBERS[_i]
_i = _i + 1
EDUP
UNDEFINE IZ!
UNDEFINE IZL!
UNDEFINE IZH!
UNDEFINE IZ_PREFIX!
| 36.338983 | 137 | 0.343084 | [
"MIT"
] | Retro-Tek/zxspectrum-sprites | sprites.asm | 15,008 | Assembly |
; A075907: Fourth column of triangle A075499.
; Submitted by Jon Maiga
; 1,40,1040,22400,435456,7956480,139694080,2387968000,40075329536,663887544320,10896534405120,177653730508800,2882307270639616,46596186764738560,751299029274460160,12089975328525516800
mov $1,$0
mov $0,4
pow $0,$1
seq $1,453 ; Stirling numbers of the second kind, S(n,4).
mul $1,$0
mov $0,$1
| 33.090909 | 184 | 0.788462 | [
"Apache-2.0"
] | ckrause/loda-programs | oeis/075/A075907.asm | 364 | Assembly |
SECTION code_clib
PUBLIC xorpixel
EXTERN __gfx_coords
;
; $Id: xorpixl.asm,v 1.9 2016-07-02 09:01:36 dom Exp $
;
; ******************************************************************
;
; XORs pixel at (x,y) coordinate.
;
; ZX 81 version.
; 64x48 dots.
;
.xorpixel
ld a,h
cp 64
ret nc
ld a,l
;cp maxy
cp 48
ret nc ; y0 out of range
ld (__gfx_coords),hl
push bc
ld c,l
ld b,h
push bc
srl b
srl c
IF FORlambda
ld hl,16510
ELSE
ld hl,(16396) ; D_FILE
inc hl
ENDIF
;ld a,b
ld a,c
ld c,b ; !!
ld de,33 ; 32+1. Every text line ends with an HALT
and a
jr z,r_zero
ld b,a
.r_loop
add hl,de
djnz r_loop
.r_zero ; hl = char address
ld e,c
add hl,de
ld a,(hl) ; get current symbol
cp 8
jr c,islow ; recode graph symbol to binary -> 0..F
ld a,143
sub (hl)
.islow ex (sp),hl ; save char address <=> restore x,y
cp 16 ; Just to be sure:
jr c,issym ; if it isn't a symbol...
xor a ; .. force to blank sym
.issym
ld b,a
ld a,1 ; the bit we want to XOR
bit 0,h
jr z,iseven
add a,a ; move right the bit
.iseven
bit 0,l
jr z,evenrow
add a,a
add a,a ; move down the bit
.evenrow
xor b
cp 8 ; Now back from binary to
jr c,hisym ; graph symbols.
ld b,a
ld a,15
sub b
add a,128
.hisym
pop hl
ld (hl),a
pop bc
ret
| 15.340206 | 68 | 0.508737 | [
"BSD-2-Clause"
] | ByteProject/Puddle-BuildTools | FictionTools/z88dk/libsrc/target/zx81/graphics/xorpixl.asm | 1,488 | Assembly |
; A048480: a(n) = T(8,n), array T given by A048472.
; 1,10,37,109,289,721,1729,4033,9217,20737,46081,101377,221185,479233,1032193,2211841,4718593,10027009,21233665,44826625,94371841,198180865,415236097,868220929,1811939329,3774873601,7851737089,16307453953,33822867457,70061654017,144955146241,299573968897,618475290625,1275605286913,2628519985153,5411658792961,11132555231233,22883585753089,47004122087425,96482145337345,197912092999681,405719790649345,831230790598657,1702043999797249,3483252836794369,7124835347988481,14566330044776449,29765978787151873,60798594969501697,124130464729399297,253327479039590401,516788057240764417,1053842312804696065,2148217022255726593,4377498837804122113,8917127262193582081,18158513697557839873,36965545741457031169,75228128175596765185,153050329736558936065,311288806243848683521,632953906029158989825,1286660399141241225217,2614825972448328941569,5312662293228350865409,10791345283120087695361,21914731959566947319809,44493546705787438497793,90315258984881964711937,183286849116378104856577,371886360525984560578561,754398045638425822887937,1530046740449765049237505,3102594779245356905398273,6290192155182367424643073,12750389503748042076979201,25840789394262698609344513,52361599562058626129461249,106083240671183710080466945,214886564436500335804022785,435213295061266502894223361,881306922499064668360802305,1784374509751192661866315777,3612270349008511974022053889,7311583357029277248622952449,14797252032083061098403594241,29942674700215135399122567169,60581690672528297202875891713,122556063889252647215013298177,247897492866897400048549625857,501365715910579011334145310721,1013872892174726445142382739457,2050028705056589735232949714945,4144623251527453160362267901953,8378378185883453700517272748033,16935019737424002160620019384321,34226566206162193840410986545153,69166185874952766719163868643329,139758478675162291515011528392705,282369171200838099183390638997505
mov $1,2
pow $1,$0
mul $1,$0
div $1,2
mul $1,9
add $1,1
mov $0,$1
| 180.363636 | 1,864 | 0.922379 | [
"Apache-2.0"
] | ckrause/cm | programs/oeis/048/A048480.asm | 1,984 | Assembly |
copyright zengfr site:http://github.com/zengfr/romhack
00042A move.l D1, (A0)+
00042C dbra D0, $42a
00049A move.w #$9080, ($2a,A5)
0004A0 move.w #$90c0, ($2c,A5) [base+ 2A]
00058E move.w #$9080, ($2a,A5)
000594 tst.b ($4aa,A5) [base+ 2A]
0AAACA move.l (A0), D2
0AAACC move.w D0, (A0) [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1]
0AAACE move.w D0, ($2,A0)
0AAAD2 cmp.l (A0), D0
0AAAD4 bne $aaafc
0AAAD8 move.l D2, (A0)+
0AAADA cmpa.l A0, A1 [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1]
0AAAE6 move.l (A0), D2
0AAAE8 move.w D0, (A0) [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1]
0AAAF4 move.l D2, (A0)+
0AAAF6 cmpa.l A0, A1 [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1]
copyright zengfr site:http://github.com/zengfr/romhack
| 86.318182 | 350 | 0.665613 | [
"Apache-2.0"
] | zengfr/arcade_game_romhacking_sourcecode_top_secret_data | dino/lcs/base/2A.asm | 1,899 | Assembly |
LDA f100
MOV B, A
MOV C, A
MVI D, 04 // counter
MVI E, 00 // flag
LOOP:
MOV A, C
RLC
MOV C, A
XRA B
ANI 01
JNZ NO
MOV A, B
RRC
MOV B, A
DCR D
JNZ LOOP
INR E
NO: MOV A, E
STA f200
HLT
| 7.40625 | 20 | 0.489451 | [
"MIT"
] | SohamMalakar/Intel-8085 | samples/eight_bit_palindrome.asm | 237 | Assembly |
ori $ra,$ra,0xf
ori $5,$6,34618
mthi $5
mfhi $4
mflo $1
mult $6,$6
lui $4,29084
mult $0,$2
mtlo $4
mtlo $5
sb $1,0($0)
divu $4,$ra
srav $0,$4,$4
mthi $0
mthi $1
srav $3,$5,$3
lui $2,27209
addiu $5,$2,4312
sll $6,$2,6
div $1,$ra
lui $0,60233
div $5,$ra
mflo $1
div $1,$ra
lb $1,15($0)
lui $1,41704
div $2,$ra
mfhi $0
mthi $5
addu $6,$4,$5
addu $0,$5,$1
mthi $0
mthi $5
ori $5,$4,23383
div $1,$ra
mtlo $5
mfhi $3
mtlo $5
div $1,$ra
sll $5,$5,28
mfhi $2
div $0,$ra
addu $3,$5,$3
mflo $1
mthi $6
mult $2,$0
mtlo $0
addu $4,$0,$3
ori $0,$5,65247
addu $6,$0,$6
lui $1,39563
addu $5,$1,$1
mtlo $5
multu $5,$4
divu $5,$ra
mthi $4
sll $1,$1,1
mthi $2
addu $0,$2,$4
mfhi $6
mflo $1
lb $1,5($0)
addiu $4,$6,-4329
ori $5,$5,6174
mtlo $1
mfhi $4
ori $4,$1,30935
sll $6,$4,26
lui $5,27417
lui $3,44174
ori $5,$4,48033
addu $3,$5,$3
addiu $4,$1,-19562
addu $2,$2,$2
multu $1,$2
srav $6,$4,$6
addiu $5,$4,20553
multu $5,$0
mult $2,$6
divu $6,$ra
mfhi $4
addu $6,$2,$2
sb $4,9($0)
divu $4,$ra
mthi $4
srav $6,$1,$3
mflo $4
lui $5,38595
sb $4,15($0)
srav $1,$1,$1
srav $4,$2,$3
mflo $4
ori $4,$3,50233
mfhi $0
div $4,$ra
ori $6,$2,17237
sb $1,8($0)
lb $3,6($0)
divu $5,$ra
ori $2,$2,51693
addu $5,$2,$1
sb $1,13($0)
multu $1,$2
mthi $0
srav $0,$4,$5
divu $5,$ra
mfhi $1
divu $0,$ra
ori $4,$6,36477
mult $2,$5
srav $2,$2,$5
addu $1,$3,$3
sll $2,$2,2
mult $2,$2
sll $0,$4,22
sb $5,12($0)
mflo $4
sll $0,$0,23
mflo $0
ori $4,$6,50902
addiu $3,$2,-11872
sb $3,11($0)
mthi $0
div $6,$ra
lb $5,9($0)
sll $1,$2,14
sll $4,$1,9
multu $5,$5
mult $4,$4
lb $6,1($0)
sll $1,$0,1
mflo $2
mtlo $4
lui $4,3461
mflo $1
mtlo $4
div $5,$ra
multu $1,$1
sb $1,10($0)
addu $4,$4,$2
div $3,$ra
mflo $2
divu $5,$ra
sll $6,$4,8
lui $5,64429
div $2,$ra
mthi $3
addu $2,$2,$2
mult $4,$1
sll $4,$1,21
srav $1,$4,$1
lui $1,64464
lb $4,6($0)
sb $4,16($0)
sll $5,$4,15
mult $4,$4
ori $6,$4,35531
multu $1,$1
sb $6,1($0)
mtlo $6
lb $4,11($0)
multu $1,$2
sb $3,3($0)
srav $0,$1,$3
mthi $1
addu $2,$1,$2
multu $5,$5
srav $0,$2,$0
mthi $1
addiu $1,$6,-14087
lui $1,14125
lb $0,14($0)
lui $4,52764
mthi $1
multu $5,$0
divu $6,$ra
mtlo $6
sb $1,12($0)
addiu $4,$4,-24185
ori $4,$2,2792
multu $4,$4
multu $4,$4
sll $4,$3,22
addu $4,$0,$2
lui $5,53947
mflo $5
ori $4,$0,9160
mthi $4
divu $5,$ra
ori $4,$1,19232
ori $1,$1,10538
divu $4,$ra
mtlo $4
addiu $1,$1,-23128
div $4,$ra
srav $1,$1,$2
divu $0,$ra
sb $5,7($0)
mult $4,$5
sll $1,$5,6
lb $1,4($0)
divu $4,$ra
sll $6,$6,1
divu $5,$ra
mfhi $5
sb $0,3($0)
mtlo $2
mthi $4
sll $4,$2,0
addu $4,$4,$4
mtlo $2
addu $2,$2,$2
lb $4,16($0)
sb $1,6($0)
divu $6,$ra
divu $6,$ra
addiu $2,$2,-22541
mtlo $2
lb $3,11($0)
sll $2,$2,30
mtlo $1
mflo $5
ori $6,$2,63191
ori $0,$0,9000
lb $5,7($0)
ori $4,$3,24593
mtlo $1
divu $3,$ra
mthi $5
div $4,$ra
mflo $2
ori $5,$1,59628
addiu $2,$2,2883
multu $2,$1
div $1,$ra
addiu $6,$4,18521
lui $1,61493
mtlo $1
ori $4,$2,25398
mtlo $1
mthi $1
mtlo $4
mfhi $4
lui $5,11813
ori $3,$2,40219
addu $5,$4,$4
mfhi $5
mult $1,$4
lb $5,16($0)
addu $4,$1,$4
addu $6,$1,$6
mfhi $5
addiu $5,$4,-24454
lb $1,8($0)
srav $6,$4,$6
sb $4,13($0)
mfhi $4
addiu $4,$0,21599
mtlo $4
mthi $5
mthi $4
addu $4,$2,$4
mtlo $4
ori $6,$4,7115
mfhi $5
multu $3,$1
addiu $4,$1,20262
div $4,$ra
mfhi $0
srav $4,$4,$5
sll $4,$4,6
mthi $1
ori $0,$1,2579
divu $0,$ra
mthi $1
mflo $2
ori $4,$1,5379
addu $1,$2,$1
mtlo $2
lb $4,12($0)
mfhi $6
ori $2,$2,64263
div $4,$ra
sll $0,$2,14
lb $0,14($0)
mfhi $4
srav $5,$4,$4
div $0,$ra
sll $4,$4,9
mtlo $4
mfhi $2
ori $4,$4,2877
lui $4,34159
ori $5,$5,46315
multu $1,$5
ori $0,$0,9380
addu $2,$2,$2
mfhi $4
div $5,$ra
sb $1,3($0)
lui $4,64594
mflo $1
addu $5,$5,$5
mthi $1
lb $3,4($0)
mult $1,$5
mfhi $4
mtlo $4
div $1,$ra
mult $1,$2
lui $0,47150
lb $5,0($0)
mtlo $2
div $1,$ra
lb $4,0($0)
addiu $1,$2,10512
ori $6,$6,24274
sll $1,$0,19
mflo $3
mtlo $2
lb $4,16($0)
mtlo $0
mfhi $3
lb $1,10($0)
divu $4,$ra
sll $1,$2,5
addu $6,$2,$6
srav $4,$4,$4
sll $4,$4,17
sb $4,12($0)
lui $2,45895
divu $0,$ra
div $5,$ra
mtlo $4
mthi $4
mthi $4
ori $0,$2,38357
divu $0,$ra
divu $5,$ra
lui $1,1727
multu $1,$5
lb $1,4($0)
ori $4,$5,58237
sb $1,1($0)
mtlo $4
mtlo $1
ori $5,$5,31481
mflo $1
sb $5,16($0)
sll $4,$2,7
addu $2,$2,$5
addiu $1,$4,4623
divu $5,$ra
mult $4,$6
mthi $2
mthi $0
div $4,$ra
mthi $2
ori $4,$4,47640
mult $4,$4
mult $5,$1
ori $4,$5,57390
mflo $6
lb $1,13($0)
addu $5,$5,$5
srav $3,$6,$3
lb $5,5($0)
srav $5,$0,$0
multu $1,$1
sll $4,$4,17
lui $1,43338
divu $4,$ra
lui $5,23090
div $4,$ra
sll $4,$4,1
divu $4,$ra
multu $2,$4
divu $0,$ra
sll $2,$2,18
mfhi $0
lui $1,22086
sll $2,$4,11
srav $1,$2,$2
lb $5,1($0)
ori $3,$5,27494
mflo $2
lb $1,2($0)
divu $5,$ra
divu $4,$ra
lui $1,61992
sll $0,$0,23
lui $4,29089
addiu $3,$2,13564
lui $5,3871
div $6,$ra
srav $0,$0,$2
lb $1,1($0)
mthi $6
mult $0,$4
sb $5,6($0)
mtlo $0
div $4,$ra
mfhi $2
mflo $3
div $0,$ra
mtlo $4
divu $1,$ra
mtlo $3
div $2,$ra
mult $0,$5
div $5,$ra
div $5,$ra
addiu $5,$5,13803
divu $4,$ra
div $4,$ra
lui $0,13505
lui $4,32689
mult $0,$0
multu $5,$5
srav $1,$2,$1
mult $1,$2
div $0,$ra
div $4,$ra
lui $0,37161
mtlo $1
addu $6,$4,$6
mfhi $3
sb $5,16($0)
mult $2,$0
multu $4,$4
sb $5,14($0)
mtlo $4
mthi $1
mthi $1
multu $4,$1
mthi $2
mthi $5
lui $4,62200
multu $2,$2
multu $4,$1
lui $5,56106
sll $5,$5,27
addiu $6,$1,-23551
lb $5,14($0)
divu $3,$ra
lui $3,23971
addu $5,$2,$3
div $4,$ra
addu $2,$2,$3
srav $2,$2,$2
divu $5,$ra
ori $5,$1,20561
mthi $5
mtlo $3
multu $4,$4
addiu $4,$2,12368
sll $4,$2,30
srav $0,$2,$2
lb $2,12($0)
divu $1,$ra
mflo $4
ori $4,$3,20536
mult $0,$5
mfhi $2
sll $2,$2,31
divu $6,$ra
mfhi $4
mthi $1
addu $1,$5,$5
mult $2,$2
mthi $2
lb $6,3($0)
lb $4,10($0)
ori $5,$5,8145
addiu $2,$2,1322
addiu $0,$4,14197
mult $4,$4
mfhi $5
ori $5,$2,65192
lb $1,11($0)
addiu $6,$0,4527
mthi $0
ori $6,$0,42128
lb $4,5($0)
multu $1,$1
div $4,$ra
sb $4,10($0)
lb $0,3($0)
ori $4,$2,45282
mfhi $4
multu $4,$1
divu $4,$ra
mtlo $4
sb $4,12($0)
multu $4,$4
sll $4,$5,28
sb $4,1($0)
mfhi $4
mtlo $1
addiu $4,$4,17505
addu $1,$1,$1
sll $4,$4,3
mflo $0
mthi $1
addiu $4,$2,13335
srav $0,$2,$2
mfhi $1
lb $1,1($0)
ori $4,$4,27114
ori $4,$2,64520
sb $4,2($0)
mthi $4
lb $4,13($0)
div $5,$ra
lb $0,16($0)
divu $1,$ra
ori $1,$4,1895
multu $1,$3
divu $6,$ra
divu $2,$ra
ori $2,$5,46890
lb $1,1($0)
ori $3,$6,48091
mthi $5
multu $1,$2
lui $5,8228
addu $5,$2,$2
mfhi $0
mflo $1
addiu $5,$3,16382
lb $4,10($0)
divu $4,$ra
sll $1,$5,16
addiu $5,$2,10206
ori $5,$4,7405
addu $2,$2,$2
mtlo $0
sll $5,$6,24
mflo $2
lb $1,5($0)
multu $5,$1
multu $1,$4
multu $0,$0
mflo $4
div $4,$ra
multu $4,$5
addiu $5,$1,30687
lui $5,57402
sll $4,$2,26
srav $2,$2,$0
mfhi $1
mtlo $1
sll $6,$5,5
mult $1,$4
sll $4,$6,22
addu $4,$4,$3
addu $2,$6,$2
div $2,$ra
lb $0,2($0)
ori $4,$0,29595
sb $2,3($0)
mtlo $1
sb $0,0($0)
lui $5,59876
srav $4,$4,$4
lb $4,3($0)
mult $1,$1
mthi $4
multu $2,$2
mthi $5
srav $4,$4,$2
div $0,$ra
srav $0,$1,$0
sll $6,$2,28
divu $6,$ra
addu $5,$0,$5
mtlo $3
addiu $5,$1,14988
srav $6,$5,$1
mult $0,$1
mtlo $2
addu $6,$4,$2
addu $5,$6,$4
divu $5,$ra
mult $5,$5
ori $2,$2,15239
sll $4,$4,23
mtlo $6
sll $1,$4,18
multu $4,$1
divu $1,$ra
lui $4,55634
mtlo $4
multu $4,$0
ori $4,$1,32989
addiu $0,$3,-12768
divu $5,$ra
mult $6,$2
mthi $5
mflo $5
mflo $2
multu $6,$2
lui $4,29570
mult $4,$4
divu $4,$ra
addiu $3,$3,-26514
multu $2,$2
lui $4,8040
mtlo $1
lb $2,0($0)
mthi $6
sll $5,$4,27
mult $1,$1
divu $1,$ra
mflo $5
ori $5,$1,25364
lb $5,2($0)
mtlo $2
sll $2,$2,0
ori $6,$6,41133
srav $0,$5,$0
mfhi $5
mtlo $4
lb $4,5($0)
multu $2,$2
mthi $3
addu $0,$0,$0
mfhi $4
addu $4,$6,$4
lui $3,59235
addu $4,$4,$4
addiu $2,$2,3437
addiu $4,$4,12251
lui $2,1973
sb $5,12($0)
addu $0,$5,$0
mflo $4
sb $1,6($0)
lui $4,47137
multu $0,$2
addu $4,$5,$3
mthi $0
div $2,$ra
addiu $4,$4,2255
divu $2,$ra
sb $1,4($0)
srav $4,$2,$4
mult $4,$4
mtlo $4
sb $5,13($0)
ori $1,$4,28248
mflo $5
sb $5,10($0)
mult $4,$4
mult $4,$4
addu $6,$6,$6
addiu $1,$5,-21523
mult $1,$3
addu $5,$2,$4
addu $4,$1,$3
divu $4,$ra
div $5,$ra
lb $5,0($0)
divu $5,$ra
addu $1,$2,$5
div $5,$ra
mthi $4
addiu $4,$4,31303
srav $5,$1,$2
lb $5,2($0)
srav $1,$1,$1
ori $4,$2,52235
lui $1,85
mult $3,$2
lui $0,10270
ori $4,$5,19383
lui $5,14800
lb $2,8($0)
lb $4,12($0)
lui $0,47655
multu $4,$1
mtlo $1
mthi $4
lui $4,8878
mult $1,$1
multu $0,$6
mthi $0
divu $5,$ra
addiu $4,$6,11852
mfhi $1
div $0,$ra
ori $5,$2,31990
ori $1,$2,9264
addiu $2,$6,29609
ori $6,$5,44393
mtlo $4
sll $5,$2,30
addu $2,$2,$2
lui $4,19785
srav $1,$4,$2
multu $0,$0
srav $5,$6,$1
divu $4,$ra
addiu $4,$2,31228
addiu $5,$4,-14613
sb $2,9($0)
mfhi $5
mthi $4
mflo $4
mflo $6
div $2,$ra
addiu $1,$4,12218
sll $6,$4,31
sll $6,$1,23
mfhi $4
mflo $0
mtlo $4
div $6,$ra
divu $6,$ra
multu $4,$5
divu $5,$ra
lb $0,12($0)
addiu $4,$1,-3619
addiu $5,$5,-20380
ori $2,$2,49706
ori $5,$5,56935
addu $1,$2,$5
sll $5,$4,23
addu $4,$4,$4
sb $4,11($0)
mtlo $1
srav $4,$4,$4
srav $5,$4,$5
divu $6,$ra
mtlo $4
addu $0,$0,$4
divu $0,$ra
mthi $4
lui $1,64325
srav $4,$1,$2
lui $1,7957
mthi $1
addiu $1,$4,-32313
mult $0,$1
sll $4,$2,3
lb $2,11($0)
mult $3,$3
mflo $5
multu $2,$2
mtlo $1
addu $1,$4,$4
ori $0,$4,51376
mfhi $1
addiu $1,$5,30239
div $0,$ra
lb $5,8($0)
mult $4,$4
sll $4,$0,15
addiu $4,$3,-24502
addu $4,$2,$4
divu $6,$ra
addu $0,$2,$2
mtlo $0
mthi $2
lui $1,35376
srav $5,$3,$3
sll $4,$4,30
lb $1,11($0)
div $2,$ra
multu $4,$2
mthi $1
addiu $5,$2,-16131
addiu $3,$3,14546
lb $2,13($0)
mflo $6
srav $1,$6,$5
lui $4,60417
multu $3,$4
mflo $4
mult $2,$2
ori $0,$5,6830
srav $4,$4,$1
sll $4,$1,13
divu $6,$ra
addu $3,$3,$3
srav $5,$1,$4
lui $1,30861
mfhi $4
mthi $5
lui $3,23200
sb $5,7($0)
lb $4,13($0)
mtlo $1
lui $5,39447
mflo $2
mthi $4
mflo $1
mtlo $6
divu $4,$ra
addu $5,$4,$1
sb $5,8($0)
div $4,$ra
mtlo $1
mtlo $4
lb $1,1($0)
sb $4,6($0)
multu $1,$1
mfhi $1
divu $5,$ra
mult $4,$2
sb $3,14($0)
div $5,$ra
addu $1,$2,$3
lb $2,14($0)
addiu $1,$4,6491
multu $6,$5
mfhi $5
srav $1,$1,$1
mfhi $5
mtlo $2
addiu $0,$5,16782
multu $3,$4
addiu $4,$4,-20784
lb $0,1($0)
mtlo $0
lui $5,24102
div $1,$ra
mthi $3
divu $3,$ra
lui $0,41213
mult $0,$2
sll $2,$2,30
addiu $5,$2,22669
mthi $2
addu $5,$2,$0
div $1,$ra
ori $5,$4,41124
multu $5,$2
mfhi $4
multu $4,$4
sll $1,$5,17
mtlo $3
addu $5,$4,$5
addu $4,$1,$1
mthi $1
mflo $5
lui $6,27878
mflo $4
multu $2,$5
mult $6,$5
divu $4,$ra
lui $0,64743
mflo $2
sb $1,5($0)
addu $4,$4,$2
ori $0,$0,14148
lb $4,5($0)
srav $6,$2,$6
multu $5,$4
multu $5,$6
mtlo $4
addu $3,$3,$3
div $4,$ra
mfhi $5
divu $2,$ra
mflo $4
mult $5,$2
div $5,$ra
mtlo $5
addu $5,$6,$4
multu $1,$1
multu $4,$4
ori $5,$5,20019
sb $5,11($0)
mfhi $4
lb $4,4($0)
multu $4,$2
multu $6,$4
ori $4,$5,37944
mthi $5
mflo $4
ori $4,$5,64523
mult $5,$4
mult $4,$6
mflo $2
ori $1,$2,61449
addu $4,$4,$4
mthi $5
div $4,$ra
| 11.937079 | 18 | 0.570218 | [
"Apache-2.0"
] | alxzzhou/BUAA_CO_2020 | P6/data_P6_2/MDTest6.asm | 10,624 | Assembly |
FuchsiaPokecenterObject:
db $0 ; border block
db $2 ; warps
db $7, $3, $2, $ff
db $7, $4, $2, $ff
db $0 ; signs
db $4 ; objects
object SPRITE_NURSE, $3, $1, STAY, DOWN, $1 ; person
object SPRITE_ROCKER, $2, $3, STAY, NONE, $2 ; person
object SPRITE_LASS, $6, $5, WALK, $2, $3 ; person
object SPRITE_NURSE, $b, $2, STAY, DOWN, $4 ; person
; warp-to
EVENT_DISP FUCHSIA_POKECENTER_WIDTH, $7, $3
EVENT_DISP FUCHSIA_POKECENTER_WIDTH, $7, $4
| 23.842105 | 54 | 0.644592 | [
"MIT"
] | ETDV-TheVoid/pokemon-rgb-enhanced | data/mapObjects/fuchsiapokecenter.asm | 453 | Assembly |
JumpIfPositive: MACRO target
jp p, target
ENDM
JumpIfNegative: MACRO target
jp m, target
ENDM
JumpIfUnderflow: MACRO target
jp po, target
ENDM
JumpIfOverflow: MACRO target
jp po, target
ENDM
;.. Bit routines
JumpOnMemBitSet: MACRO mem, bitnbr, target
ld a,(mem)
bit bitnbr,a
jp nz,target
ENDM
JumpOnMemBitClear: MACRO mem, bitnbr, target
ld a,(mem)
bit bitnbr,a
jp z,target
ENDM
JumpOnBitSet: MACRO reg, bitnbr, target
bit bitnbr,reg
jp nz,target
ENDM
JumpOnBitClear: MACRO reg, bitnbr, target
bit bitnbr,reg
jp z,target
ENDM
ReturnOnBitSet: MACRO reg, bitnbr,
bit bitnbr,reg
ret nz
ENDM
ReturnOnMemBitSet: MACRO mem, bitnbr
ld a,(mem)
bit bitnbr,a
ret nz
ENDM
ReturnOnBitClear: MACRO reg, bitnbr
bit bitnbr,reg
ret z
ENDM
ReturnOnMemBitClear: MACRO mem, bitnbr
ld a,(mem)
bit bitnbr,a
ret z
ENDM
; Comparison Routines
JumpIfAGTEusng: MACRO
jp nc,target
ENDM
JumpIfAGTENusng: MACRO reg,target
cp reg
jp nc,target
ENDM
JumpIfAGTEMemusng: MACRO mem,target
ld hl,mem
cp (hl)
jp nc,target
ENDM
JumpIfALTMemusng: MACRO mem,target
ld hl,mem
cp (hl)
jp c,target
ENDM
CallIfAGTENusng: MACRO reg,target
cp reg
call nc,target
ENDM
CallIfALTNusng: MACRO reg,target
cp reg
call c,target
ENDM
JumpIfMemGTENusng: MACRO mem, value, target
ld a,(mem)
cp value
jp nc,target
ENDM
JumpIfMemGTEMemusng: MACRO mem, address, target
ld a,(mem)
ld hl,address
cp (hl)
jp nc,target
ENDM
JumpIfMemEqMemusng: MACRO mem, address, target
ld a,(mem)
ld hl,address
cp (hl)
jp z,target
ENDM
CallIfMemEqMemusng: MACRO mem, address, target
ld a,(mem)
ld hl,address
cp (hl)
call z,target
ENDM
JumpIfALTusng: MACRO target
jp c,target
ENDM
JumpIfALTNusng: MACRO value, target
cp value
jp c, target
ENDM
JumpIfMemLTNusng: MACRO mem, value, target
ld a,(mem)
cp value
jp c,target
ENDM
JumpIfMemLTMemusng: MACRO mem, value, target
ld a,(mem)
ld hl,value
cp (hl)
jp c,target
ENDM
JumpIfMemEqNusng: MACRO mem,value,target
ld a,(mem)
cp value
jp z,target
ENDM
JumpIfMemNeNusng: MACRO mem,value,target
ld a,(mem)
cp value
jp nz,target
ENDM
JumpIfMemZero: MACRO mem,target
ld a,(mem)
and a
jr z,target
ENDM
JumpIfALTMemHLusng: MACRO target
cp (hl)
jp c,target
ENDM
JumpIfANENusng: MACRO value, target
cp value
jp nz,target
ENDM
JumpIfANEMemusng: MACRO value, target
ld hl,value
cp (hl)
jp nz,target
ENDM
JumpIfAEqNusng: MACRO value, target
cp value
jp z,target
ENDM
IfAIsZeroGoto: MACRO target
and a ; cp 0 - changed to and a for optimisation but affects other flags
jp z, target
ENDM
IfANotZeroGoto: MACRO target
cp 0
jp nz,target
ENDM
IfResultZeroGoto: MACRO target
jp z,target
ENDM
IfResultNotZeroGoto:MACRO target
jp nz,target
ENDM
ReturnIfAIsZero: MACRO
and a
ret z
ENDM
ReturnIfMemisZero: MACRO mem
ld a,(mem)
and a
ret z
ENDM
ReturnIfMemEquN: MACRO mem, value
ld a,(mem)
cp value
ret z
ENDM
ReturnIfANotZero: MACRO
cp 0
ret nz
ENDM
ReturnIfMemNotZero: MACRO mem
ld a,(mem)
cp 0
ret nz
ENDM
ReturnIfAGTEusng: MACRO value
cp value
ret nc
ENDM
ReturnIfALTNusng: MACRO value
cp value
ret c
ENDM
ReturnIfAGTENusng: MACRO value
cp value
ret nc
ENDM
ReturnIfANENusng: MACRO value
cp value
ret nz
ENDM
ReturnIfAEqNusng: MACRO value
cp value
ret z
ENDM
SetCarryFlag: MACRO
scf
ENDM
ClearCarryFlag: MACRO
or a
ENDM
FlipCarryFlag: MACRO
ccf
ENDM
pushbcde: MACRO
push bc
push de
ENDM
popdebc: MACRO
pop de
pop bc
ENDM
pushhlde: MACRO
push hl
push de
ENDM
popdehl: MACRO
pop de
pop hl
ENDM
pushbcdeaf: MACRO
push bc
push de
push af
ENDM
popafdebc: MACRO
pop af
pop de
pop bc
ENDM
NegIY: MACRO
xor a
sub iyl
ld iyl,a
sbc a,a
sub iyh
ld iyh,a
ENDM
NegHL: MACRO
xor a
sub l
ld l,a
sbc a,a
sub h
ld h,a
ENDM
NegDE: MACRO
xor a
sub e
ld e,a
sbc a,a
sub d
ld d,a
ENDM
NegBC: MACRO
xor a
sub c
ld c,a
sbc a,a
sub b
ld b,a
ENDM
NegH MACRO
ld a,h
neg
ld h,a
ENDM
NegD MACRO
ld a,d
neg
ld d,a
ENDM
NegB MACRO
ld a,b
neg
ld b,a
ENDM
FourLDIInstrunctions: MACRO
ldi
ldi
ldi
ldi
ENDM
FiveLDIInstrunctions: MACRO
ldi
ldi
ldi
ldi
ldi
ENDM
SixLDIInstrunctions: MACRO
ldi
ldi
ldi
ldi
ldi
ldi
ENDM
EightLDIInstrunctions: MACRO
ldi
ldi
ldi
ldi
ldi
ldi
ldi
ldi
ENDM
NineLDIInstrunctions: MACRO
ldi
ldi
ldi
ldi
ldi
ldi
ldi
ldi
ldi
ENDM
FlipMemSign: MACRO mem
ld a,(mem)
xor SignOnly8Bit
ld (mem),a
ENDM
| 26.82134 | 79 | 0.298362 | [
"Unlicense"
] | ped7g/EliteNext | Macros/generalMacros.asm | 10,809 | Assembly |
<%
import collections
import pwnlib.abi
import pwnlib.constants
import pwnlib.shellcraft
import six
%>
<%docstring>brk(addr) -> str
Invokes the syscall brk.
See 'man 2 brk' for more information.
Arguments:
addr(void*): addr
Returns:
int
</%docstring>
<%page args="addr=0"/>
<%
abi = pwnlib.abi.ABI.syscall()
stack = abi.stack
regs = abi.register_arguments[1:]
allregs = pwnlib.shellcraft.registers.current()
can_pushstr = ['addr']
can_pushstr_array = []
argument_names = ['addr']
argument_values = [addr]
# Load all of the arguments into their destination registers / stack slots.
register_arguments = dict()
stack_arguments = collections.OrderedDict()
string_arguments = dict()
dict_arguments = dict()
array_arguments = dict()
syscall_repr = []
for name, arg in zip(argument_names, argument_values):
if arg is not None:
syscall_repr.append('%s=%s' % (name, pwnlib.shellcraft.pretty(arg, False)))
# If the argument itself (input) is a register...
if arg in allregs:
index = argument_names.index(name)
if index < len(regs):
target = regs[index]
register_arguments[target] = arg
elif arg is not None:
stack_arguments[index] = arg
# The argument is not a register. It is a string value, and we
# are expecting a string value
elif name in can_pushstr and isinstance(arg, (six.binary_type, six.text_type)):
if isinstance(arg, six.text_type):
arg = arg.encode('utf-8')
string_arguments[name] = arg
# The argument is not a register. It is a dictionary, and we are
# expecting K:V paris.
elif name in can_pushstr_array and isinstance(arg, dict):
array_arguments[name] = ['%s=%s' % (k,v) for (k,v) in arg.items()]
# The arguent is not a register. It is a list, and we are expecting
# a list of arguments.
elif name in can_pushstr_array and isinstance(arg, (list, tuple)):
array_arguments[name] = arg
# The argument is not a register, string, dict, or list.
# It could be a constant string ('O_RDONLY') for an integer argument,
# an actual integer value, or a constant.
else:
index = argument_names.index(name)
if index < len(regs):
target = regs[index]
register_arguments[target] = arg
elif arg is not None:
stack_arguments[target] = arg
# Some syscalls have different names on various architectures.
# Determine which syscall number to use for the current architecture.
for syscall in ['SYS_brk']:
if hasattr(pwnlib.constants, syscall):
break
else:
raise Exception("Could not locate any syscalls: %r" % syscalls)
%>
/* brk(${', '.join(syscall_repr)}) */
%for name, arg in string_arguments.items():
${pwnlib.shellcraft.pushstr(arg, append_null=(b'\x00' not in arg))}
${pwnlib.shellcraft.mov(regs[argument_names.index(name)], abi.stack)}
%endfor
%for name, arg in array_arguments.items():
${pwnlib.shellcraft.pushstr_array(regs[argument_names.index(name)], arg)}
%endfor
%for name, arg in stack_arguments.items():
${pwnlib.shellcraft.push(arg)}
%endfor
${pwnlib.shellcraft.setregs(register_arguments)}
${pwnlib.shellcraft.syscall(syscall)}
| 33.941176 | 87 | 0.632871 | [
"MIT"
] | 0x3c3e/pwntools | pwnlib/shellcraft/templates/common/linux/syscalls/brk.asm | 3,462 | Assembly |
org 0x100
cpu 8086
programBase:
pitCyclesPerScanline equ 76 ; Fixed by CGA hardware
scanlinesPerFrame equ 262 ; Fixed by NTSC standard
activeScanlines equ 200 ; Standard CGA full-screen
visual_profiler equ 0
onScreenPitCycles equ pitCyclesPerScanline*activeScanlines - 22
offScreenPitCycles equ pitCyclesPerScanline*scanlinesPerFrame - (onScreenPitCycles)
%include "tables.inc"
setupMemory:
mov ax,cs
mov ds,ax
cli
mov ss,ax
mov sp,stackHigh
sti
segmentAdjust equ ((sinTable - programBase) + 0x100)
add ax,segmentAdjust >> 4
mov [innerLoopDS],ax
mov ax,0x40
mov ds,ax
checkMotorShutoff:
cmp byte[0x40],0
je noMotorShutoff
mov byte[0x40],1
jmp checkMotorShutoff
noMotorShutoff:
mov ax,cs
mov ds,ax
in al,0x61
or al,0x80
mov [port61high+1],al
and al,0x7f
mov [port61low+1],al
mov si,image
mov ax,0xb800
xor di,di
mov es,ax
mov cx,8000
rep movsw
mov dx,0x3d8
mov al,9
out dx,al
mov dl,0xd4
mov ax,0x0f03
out dx,ax
mov ax,0x7f04
out dx,ax
mov ax,0x6406
out dx,ax
mov ax,0x7007
out dx,ax
mov ax,0x0109
out dx,ax
mov dl,0xda
cli
xor ax,ax
mov ds,ax
mov al,0x34
out 0x43,al
%macro setPIT0Count 1
mov al,(%1) & 0xff
out 0x40,al
%if ((%1) & 0xff) != ((%1) >> 8)
mov al,(%1) >> 8
%endif
out 0x40,al
%endmacro
setPIT0Count 2 ; PIT was reset so we start counting down from 2 immediately
%macro waitForVerticalSync 0
%%waitForVerticalSync:
in al,dx
test al,8
jz %%waitForVerticalSync ; jump if not +VSYNC, finish if +VSYNC
%endmacro
%macro waitForNoVerticalSync 0
%%waitForNoVerticalSync:
in al,dx
test al,8
jnz %%waitForNoVerticalSync ; jump if +VSYNC, finish if -VSYNC
%endmacro
; Wait for a while to be sure that IRQ0 is pending
waitForVerticalSync
waitForNoVerticalSync
waitForVerticalSync
waitForDisplayEnable:
in al,dx
test al,1
jnz waitForDisplayEnable
setPIT0Count onScreenPitCycles
; PIT channel 0 is now counting down from onScreenPitCycles in top half of onscreen area and IRQ0 is pending
mov ax,[0x20]
mov [cs:oldInterrupt8],ax
mov ax,[0x22]
mov [cs:oldInterrupt8+2],ax
mov word[0x20],transitionHandler
mov [0x22],cs
idle:
sti
.loop:
hlt
jmp .loop
transitionHandler:
mov al,0x20
out 0x20,al
; PIT channel 0 is now counting down from onScreenPitCycles in onscreen area
setPIT0Count offScreenPitCycles
; When the next interrupt happens, PIT channel 0 will start counting down from offScreenPitCycles in offscreen area
mov word[0x20],offScreenHandler
mov [0x22],cs
mov ax,cs
mov ds,ax
sti
foregroundTask:
hlt
jmp foregroundTask
align 16, db 0
dataTables
oldInterrupt8: dw 0, 0
frameCount: dw 0, 0
alphaX: dw 0
alphaY: dw 0
betaX: dw 0
betaY: dw 0
innerLoopDS: dw 0
offScreenHandler:
push ax
push ds
push es
push si
push di
mov al,0x20
out 0x20,al
xor ax,ax
mov ds,ax
mov word[0x20],onScreenHandler
setPIT0Count onScreenPitCycles
mov ax,0xb800
mov es,ax
mov ax,cs
mov ds,ax
mov si,plasmaData
mov di,initialUpdateOffset
updateRoutine
pop di
pop si
pop es
pop ds
pop ax
iret
onScreenHandler:
push ax
push bx
push cx
push dx
push si
push di
push bp
push es
push ds
mov al,0x20
out 0x20,al
xor ax,ax
mov ds,ax
mov word[0x20],offScreenHandler
setPIT0Count offScreenPitCycles
mov ax,cs
mov ds,ax
mov es,ax
inc word[frameCount]
jnz noFrameCountCarry
inc word[frameCount+2]
noFrameCountCarry:
checkKey:
; Read the keyboard byte and store it
in al,0x60
xchg ax,bx
; Acknowledge the previous byte
port61high:
mov al,0xcf
out 0x61,al
port61low:
mov al,0x4f
out 0x61,al
cmp bl,1
je teardown
; Plasma inner loop
; Registers:
; SI = pointer into sinTable for alphaX
; BP = pointer into sinTable for betaX
; DX = pointer into sinTable for alphaY
; CX = pointer into sinTable for betaY
; ES:DI = plasmaData buffer pointer
; AL = v
; AH = vy
; BX = gradientTable
; DS:0 = sinTable
; SS:0 = sinTable
%macro plasmaIteration 2
%if %2 != 0
add si,%2*5-1
%else
dec si
%endif
lodsb
%if %2 != 0
add bx,%2*40
%endif
add al,[bx]
xchg ax,si
%if %1 == 1
mov si,[bp+si+1568]
%else
mov si,[bp+si]
%endif
xchg ax,si
stosw
%endmacro
%macro plasmaIncrementY 0
add dx,24
and dx,0x1ff
mov bx,dx
mov ah,[bx]
add cx,3
and cx,0x1ff
mov bx,cx
add ah,[bx]
mov bx,gradientTable - segmentAdjust
%endmacro
mov ax,[innerLoopDS]
mov ds,ax
mov ss,ax
mov dx,[alphaY - segmentAdjust]
add dx,16
and dx,0x1ff
mov [alphaY - segmentAdjust],dx
mov bx,dx
mov ah,[bx]
mov cx,[betaY - segmentAdjust]
dec cx
and cx,0x1ff
mov [betaY - segmentAdjust],cx
mov bx,cx
add ah,[bx]
mov bx,gradientTable - segmentAdjust
mov di,plasmaData
mov si,[alphaX - segmentAdjust]
add si,8
mov [alphaX - segmentAdjust],si
mov bp,[betaX - segmentAdjust]
add bp,2
mov [betaX - segmentAdjust],bp
plasmaRoutine
mov ax,cs
mov ss,ax
pop ds
pop es
pop bp
pop di
pop si
pop dx
pop cx
pop bx
pop ax
iret
teardown:
xor ax,ax
mov ds,ax
cli
mov ax,[cs:oldInterrupt8]
mov [0x20],ax
mov ax,[cs:oldInterrupt8+2]
mov [0x22],ax
sti
in al,0x61
and al,0xfc
out 0x61,al
mov ax,cs
mov ds,ax
setPIT0Count 0
mov ax,3
int 0x10
mov ax,19912
mul word[frameCount]
mov cx,dx
mov ax,19912
mul word[frameCount+2]
add ax,cx
adc dx,0
mov cx,0x40
mov ds,cx
add [0x6c],ax
adc [0x6e],dx
dateLoop:
cmp word[0x6c],0x18
jb doneDateLoop
cmp word[0x6e],0xb0
jb doneDateLoop
mov byte[0x70],1
sub word[0x6c],0xb0
sbb word[0x6e],0x18
jmp dateLoop
doneDateLoop:
exit:
mov ax,0x4c00
int 0x21
programEnd:
section .bss
stackLow:
resb 1024
stackHigh:
plasmaData:
| 15.784574 | 117 | 0.675484 | [
"Unlicense"
] | reenigne/reenigne | 8088/cga/plasma/plasma.asm | 5,935 | Assembly |
db PIDGEOT ; pokedex id
db 83 ; base hp
db 80 ; base attack
db 75 ; base defense
db 101 ; base speed
db 70 ; base special
db NORMAL ; species type 1
db FLYING ; species type 2
db 45 ; catch rate
db 172 ; base exp yield
INCBIN "pic/gsmon/pidgeot.pic",0,1 ; 77, sprite dimensions
dw PidgeotPicFront
dw PidgeotPicBack
; attacks known at lvl 0
db TACKLE
db 0
db 0
db 0
db 3 ; growth rate
; learnset
tmlearn 2,4,6
tmlearn 9,10,15
tmlearn 20
tmlearn 31,32
tmlearn 33,34,39
tmlearn 43,44
tmlearn 50,52
db BANK(PidgeotPicFront)
| 18.310345 | 58 | 0.728814 | [
"MIT"
] | ETDV-TheVoid/pokemon-rgb-enhanced | data/baseStats/pidgeot.asm | 531 | Assembly |
copyright zengfr site:http://github.com/zengfr/romhack
001678 move.w A0, -(A4) [base+32E]
00167A move.w A4, ($32e,A5) [base+5A8, base+5AA, base+5AC, base+5AE]
008CB6 tst.b (A1) [base+5AC, base+5AE]
009034 tst.b (A1) [base+5A8, base+5AA, base+5AC, base+5AE]
009184 tst.b (A1) [base+5A8, base+5AA, base+5AC, base+5AE]
0092BA tst.b (A1) [base+5A8, base+5AA, base+5AC, base+5AE]
0098FA tst.b (A1) [base+5AC, base+5AE]
009AD8 tst.b (A1) [base+5A8, base+5AA, base+5AC, base+5AE]
009CEC tst.b (A0) [base+5A8, base+5AA, base+5AC, base+5AE]
copyright zengfr site:http://github.com/zengfr/romhack
| 43.857143 | 70 | 0.667752 | [
"Apache-2.0"
] | zengfr/arcade_game_romhacking_sourcecode_top_secret_data | wof/lcs/base/5AC.asm | 614 | Assembly |
;******************************************************************
; 6502 BBC Micro Compressed VGM (VGC) Music Player
; By Simon Morris
; https://github.com/simondotm/vgm-player-bbc
; https://github.com/simondotm/vgm-packer
;******************************************************************
;-------------------------------
; config options
;-------------------------------
; VGM player supports VGC files that are plain LZ4 or Huffman LZ4 if ENABLE_HUFFMAN is TRUE
; Huffman decoding is variable speed and requires more Zero page, so...
; For optimal performance & memory usage you can disable huffman support.
; (just make sure you compile your VGC files without huffman of course)
ENABLE_HUFFMAN = FALSE
; Enable this to capture the SN chip register settings (for fx etc.)
ENABLE_VGM_FX = FALSE
| 40.2 | 91 | 0.578358 | [
"MIT"
] | kieranhj/rocket-beeb | lib/vgcplayer_config.h.asm | 804 | Assembly |
AnimateHealingMachine:
ld de, PokeCenterFlashingMonitorAndHealBall
ld hl, vChars0 + $7c0
lb bc, BANK(PokeCenterFlashingMonitorAndHealBall), $03 ; loads one too many tiles
call CopyVideoData
ld hl, wUpdateSpritesEnabled
ld a, [hl]
push af
ld [hl], $ff
push hl
ld a, [rOBP1]
push af
ld a, $e0
ld [rOBP1], a
ld hl, wOAMBuffer + $84
ld de, PokeCenterOAMData
call CopyHealingMachineOAM
ld a, 4
ld [wAudioFadeOutControl], a
ld a, $ff
ld [wNewSoundID], a
call PlaySound
.waitLoop
ld a, [wAudioFadeOutControl]
and a ; is fade-out finished?
jr nz, .waitLoop ; if not, check again
ld a, [wPartyCount]
ld b, a
.partyLoop
call CopyHealingMachineOAM
ld a, SFX_HEALING_MACHINE
call PlaySound
ld c, 30
call DelayFrames
dec b
jr nz, .partyLoop
ld a, [wAudioROMBank]
cp BANK(Audio3_UpdateMusic)
ld [wAudioSavedROMBank], a
jr nz, .next
ld a, $ff
ld [wNewSoundID], a
call PlaySound
ld a, BANK(Music_PkmnHealed)
ld [wAudioROMBank], a
.next
ld a, MUSIC_PKMN_HEALED
ld [wNewSoundID], a
call PlaySound
ld d, $28
call FlashSprite8Times
.waitLoop2
ld a, [wChannelSoundIDs]
cp MUSIC_PKMN_HEALED ; is the healed music still playing?
jr z, .waitLoop2 ; if so, check gain
ld c, 32
call DelayFrames
pop af
ld [rOBP1], a
pop hl
pop af
ld [hl], a
jp UpdateSprites
PokeCenterFlashingMonitorAndHealBall:
INCBIN "gfx/pokecenter_ball.2bpp"
PokeCenterOAMData:
db $24,$34,$7C,$10 ; heal machine monitor
db $2B,$30,$7D,$10 ; pokeballs 1-6
db $2B,$38,$7D,$30
db $30,$30,$7D,$10
db $30,$38,$7D,$30
db $35,$30,$7D,$10
db $35,$38,$7D,$30
; d = value to xor with palette
FlashSprite8Times:
ld b, 8
.loop
ld a, [rOBP1]
xor d
ld [rOBP1], a
ld c, 10
call DelayFrames
dec b
jr nz, .loop
ret
CopyHealingMachineOAM:
; copy one OAM entry and advance the pointers
ld a, [de]
inc de
ld [hli], a
ld a, [de]
inc de
ld [hli], a
ld a, [de]
inc de
ld [hli], a
ld a, [de]
inc de
ld [hli], a
ret
| 18.361905 | 82 | 0.696577 | [
"MIT"
] | AmateurPanda92/pokemon-rby-dx | engine/overworld/healing_machine.asm | 1,928 | Assembly |
C sparc64/aes-encrypt-internal.asm
ifelse(<
Copyright (C) 2002, 2005, 2013 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
>)
C The only difference between this code and the sparc32 code is the
C frame offsets, and the magic BIAS when accessing the stack (which
C doesn't matter, since we don't access any data on the stack).
C Use the same AES macros as on sparc32.
include_src(<sparc32/aes.m4>)
C Arguments
define(<ROUNDS>,<%i0>)
define(<KEYS>, <%i1>)
define(<T>, <%i2>)
define(<LENGTH>,<%i3>)
define(<DST>, <%i4>)
define(<SRC>, <%i5>)
C AES state, two copies for unrolling
define(<W0>, <%l0>)
define(<W1>, <%l1>)
define(<W2>, <%l2>)
define(<W3>, <%l3>)
define(<X0>, <%l4>)
define(<X1>, <%l5>)
define(<X2>, <%l6>)
define(<X3>, <%l7>)
C %o0-%03 are used for loop invariants T0-T3
define(<KEY>, <%o4>)
define(<COUNT>, <%o5>)
C %g1, %g2, %g3 are TMP1, TMP2 and TMP3
C The sparc64 stack frame looks like
C
C %fp - 8: OS-dependent link field
C %fp - 16: OS-dependent link field
C %fp - 192: OS register save area (22*8 == 176 bytes)
define(<FRAME_SIZE>, 192)
.file "aes-encrypt-internal.asm"
C _aes_encrypt(unsigned rounds, const uint32_t *keys,
C const struct aes_table *T,
C size_t length, uint8_t *dst,
C uint8_t *src)
.section ".text"
.align 16
.proc 020
PROLOGUE(_nettle_aes_encrypt)
save %sp, -FRAME_SIZE, %sp
cmp LENGTH, 0
be .Lend
C Loop invariants
add T, AES_TABLE0, T0
add T, AES_TABLE1, T1
add T, AES_TABLE2, T2
add T, AES_TABLE3, T3
C Must be even, and includes the final round
srl ROUNDS, 1, ROUNDS
C Last two rounds handled specially
sub ROUNDS, 1, ROUNDS
.Lblock_loop:
C Read src, and add initial subkey
mov KEYS, KEY
AES_LOAD(0, SRC, KEY, W0)
AES_LOAD(1, SRC, KEY, W1)
AES_LOAD(2, SRC, KEY, W2)
AES_LOAD(3, SRC, KEY, W3)
mov ROUNDS, COUNT
add SRC, 16, SRC
add KEY, 16, KEY
.Lround_loop:
C The AES_ROUND macro uses T0,... T3
C Transform W -> X
AES_ROUND(0, W0, W1, W2, W3, KEY, X0)
AES_ROUND(1, W1, W2, W3, W0, KEY, X1)
AES_ROUND(2, W2, W3, W0, W1, KEY, X2)
AES_ROUND(3, W3, W0, W1, W2, KEY, X3)
C Transform X -> W
AES_ROUND(4, X0, X1, X2, X3, KEY, W0)
AES_ROUND(5, X1, X2, X3, X0, KEY, W1)
AES_ROUND(6, X2, X3, X0, X1, KEY, W2)
AES_ROUND(7, X3, X0, X1, X2, KEY, W3)
subcc COUNT, 1, COUNT
bne .Lround_loop
add KEY, 32, KEY
C Penultimate round
AES_ROUND(0, W0, W1, W2, W3, KEY, X0)
AES_ROUND(1, W1, W2, W3, W0, KEY, X1)
AES_ROUND(2, W2, W3, W0, W1, KEY, X2)
AES_ROUND(3, W3, W0, W1, W2, KEY, X3)
add KEY, 16, KEY
C Final round
AES_FINAL_ROUND(0, T, X0, X1, X2, X3, KEY, DST)
AES_FINAL_ROUND(1, T, X1, X2, X3, X0, KEY, DST)
AES_FINAL_ROUND(2, T, X2, X3, X0, X1, KEY, DST)
AES_FINAL_ROUND(3, T, X3, X0, X1, X2, KEY, DST)
subcc LENGTH, 16, LENGTH
bne .Lblock_loop
add DST, 16, DST
.Lend:
ret
restore
EPILOGUE(_nettle_aes_encrypt)
C Stats for AES 128 on sellafield.lysator.liu.se (UE450, 296 MHz)
C 1. nettle-1.13 C-code (nettle-1.13 assembler was broken for sparc64)
C 2. New C-code
C 3. New assembler code (basically the same as for sparc32)
C MB/s cycles/block
C 1 0.8 5781
C 2 1.8 2460
C 3 8.2 548
| 24.731707 | 72 | 0.676775 | [
"MIT"
] | AdelaideCreative/strayawallet-ios | Modules/nettle/sparc64/aes-encrypt-internal.asm | 4,057 | Assembly |
; A189381: a(n) = n + [n*r/s] + [n*t/s]; r=1, s=-1+sqrt(2), t=1+sqrt(2).
; 8,17,27,36,46,54,63,73,82,92,101,109,119,128,138,147,157,165,174,184,193,203,212,220,230,239,249,258,268,276,285,295,304,314,322,331,341,350,360,369,377,387,396,406,415,425,433,442,452,461,471,480,488,498,507,517,526,536,544,553,563,572,582,591,599,609,618,628,637,645,655,664,674,683,693,701,710,720,729,739,748,756,766,775,785,794,804,812,821,831,840,850,859,867,877,886,896,905,915,923,932,942,951,961,969,978,988,997,1007,1016,1024,1034,1043,1053,1062,1072,1080,1089,1099,1108,1118,1127,1135,1145,1154,1164,1173,1183,1191,1200,1210,1219,1229,1238,1246,1256,1265,1275,1284,1292,1302,1311,1321,1330,1340,1348,1357,1367,1376,1386,1395,1403,1413,1422,1432,1441,1451,1459,1468,1478,1487,1497,1506,1514,1524,1533,1543,1552,1562,1570,1579,1589,1598,1608,1616,1625,1635,1644,1654,1663,1671,1681,1690,1700,1709,1719,1727,1736,1746,1755,1765,1774,1782,1792,1801,1811,1820,1830,1838,1847,1857,1866,1876,1884,1893,1903,1912,1922,1931,1939,1949,1958,1968,1977,1987,1995,2004,2014,2023,2033,2042,2050,2060,2069,2079,2088,2098,2106,2115,2125,2134,2144,2153,2161,2171,2180,2190,2199,2207,2217,2226,2236,2245,2255,2263,2272,2282,2291,2301,2310
mov $4,$0
add $4,1
mov $6,$0
lpb $4
mov $0,$6
sub $4,1
sub $0,$4
mov $2,$0
mov $8,2
lpb $8
mov $0,$2
sub $8,1
add $0,$8
mul $0,2
cal $0,91087 ; a(n) = floor(r*n) + floor(n/r), where r=sqrt(2).
mov $5,$0
mov $7,$8
lpb $7
mov $3,$5
sub $7,1
lpe
lpe
lpb $2
mov $2,0
sub $3,$5
lpe
mov $5,$3
add $5,5
add $1,$5
lpe
| 46.970588 | 1,132 | 0.67752 | [
"Apache-2.0"
] | jmorken/loda | programs/oeis/189/A189381.asm | 1,597 | Assembly |
; try to evolve the mon in [wWhichPokemon]
TryEvolvingMon:
ld hl, wCanEvolveFlags
xor a
ld [hl], a
ld a, [wWhichPokemon]
ld c, a
ld b, FLAG_SET
call Evolution_FlagAction
; this is only called after battle
; it is supposed to do level up evolutions, though there is a bug that allows item evolutions to occur
EvolutionAfterBattle:
ld a, [hTilesetType]
push af
xor a
ld [wEvolutionOccurred], a
dec a
ld [wWhichPokemon], a
push hl
push bc
push de
ld hl, wPartyCount
push hl
Evolution_PartyMonLoop: ; loop over party mons
ld hl, wWhichPokemon
inc [hl]
pop hl
inc hl
ld a, [hl]
cp $ff ; have we reached the end of the party?
jp z, .done
ld [wEvoOldSpecies], a
push hl
ld a, [wWhichPokemon]
ld c, a
ld hl, wCanEvolveFlags
ld b, FLAG_TEST
call Evolution_FlagAction
ld a, c
and a ; is the mon's bit set?
jp z, Evolution_PartyMonLoop ; if not, go to the next mon
ld a, [wEvoOldSpecies]
dec a
ld b, 0
ld hl, EvosMovesPointerTable
add a
rl b
ld c, a
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
push hl
ld a, [wcf91]
push af
xor a ; PLAYER_PARTY_DATA
ld [wMonDataLocation], a
call LoadMonData
pop af
ld [wcf91], a
pop hl
.evoEntryLoop ; loop over evolution entries
ld a, [hli]
and a ; have we reached the end of the evolution data?
jr z, Evolution_PartyMonLoop
ld b, a ; evolution type
cp EV_TRADE
jr z, .checkTradeEvo
; not trade evolution
ld a, [wLinkState]
cp LINK_STATE_TRADING
jr z, Evolution_PartyMonLoop ; if trading, go the next mon
ld a, b
cp EV_ITEM
jr z, .checkItemEvo
ld a, [wForceEvolution]
and a
jr nz, Evolution_PartyMonLoop
ld a, b
cp EV_LEVEL
jr z, .checkLevel
.checkTradeEvo
ld a, [wLinkState]
cp LINK_STATE_TRADING
jp nz, .nextEvoEntry1 ; if not trading, go to the next evolution entry
ld a, [hli] ; level requirement
ld b, a
ld a, [wLoadedMonLevel]
cp b ; is the mon's level greater than the evolution requirement?
jp c, Evolution_PartyMonLoop ; if so, go the next mon
jr .doEvolution
.checkItemEvo
ld a, [hli]
ld b, a ; evolution item
ld a,[wIsInBattle] ; check if we're in a battle
and a
jp nz, .nextEvoEntry1 ; If we are, skip ahead
ld a, [wcf91] ; this is supposed to be the last item used, but it is also used to hold species numbers
cp b ; was the evolution item in this entry used?
jp nz, .nextEvoEntry1 ; if not, go to the next evolution entry
.checkLevel
ld a, [hli] ; level requirement
ld b, a
ld a, [wLoadedMonLevel]
cp b ; is the mon's level greater than the evolution requirement?
jp c, .nextEvoEntry2 ; if so, go the next evolution entry
.doEvolution
ld [wCurEnemyLVL], a
ld a, 1
ld [wEvolutionOccurred], a
push hl
ld a, [hl]
ld [wEvoNewSpecies], a
ld a, [wWhichPokemon]
ld hl, wPartyMonNicks
call GetPartyMonName
call CopyStringToCF4B
ld hl, IsEvolvingText
call PrintText
ld c, 50
call DelayFrames
xor a
ld [H_AUTOBGTRANSFERENABLED], a
coord hl, 0, 0
lb bc, 12, 20
call ClearScreenArea
ld a, $1
ld [H_AUTOBGTRANSFERENABLED], a
ld a, $ff
ld [wUpdateSpritesEnabled], a
call ClearSprites
callab EvolveMon
jp c, CancelledEvolution
ld hl, EvolvedText
call PrintText
pop hl
ld a, [hl]
ld [wd0b5], a
ld [wLoadedMonSpecies], a
ld [wEvoNewSpecies], a
ld a, MONSTER_NAME
ld [wNameListType], a
ld a, BANK(TrainerNames) ; bank is not used for monster names
ld [wPredefBank], a
call GetName
push hl
ld hl, IntoText
call PrintText_NoCreatingTextBox
ld a, SFX_GET_ITEM_2
call PlaySoundWaitForCurrent
call WaitForSoundToFinish
ld c, 40
call DelayFrames
call ClearScreen
call RenameEvolvedMon
ld a, [wd11e]
push af
ld a, [wd0b5]
ld [wd11e], a
dec a
ld hl, BaseStats
ld bc, MonBaseStatsEnd - MonBaseStats
call AddNTimes
ld de, wMonHeader
call CopyData
ld a, [wd0b5]
ld [wMonHIndex], a
pop af
ld [wd11e], a
ld hl, wLoadedMonHPExp - 1
ld de, wLoadedMonStats
ld b, $1
call CalcStats
ld a, [wWhichPokemon]
ld hl, wPartyMon1
ld bc, wPartyMon2 - wPartyMon1
call AddNTimes
ld e, l
ld d, h
push hl
push bc
ld bc, wPartyMon1MaxHP - wPartyMon1
add hl, bc
ld a, [hli]
ld b, a
ld c, [hl]
ld hl, wLoadedMonMaxHP + 1
ld a, [hld]
sub c
ld c, a
ld a, [hl]
sbc b
ld b, a
ld hl, wLoadedMonHP + 1
ld a, [hl]
add c
ld [hld], a
ld a, [hl]
adc b
ld [hl], a
dec hl
pop bc
call CopyData
ld a, [wd0b5]
ld [wd11e], a
xor a
ld [wMonDataLocation], a
call LearnMoveFromLevelUp
pop hl
predef SetPartyMonTypes
ld a, [wIsInBattle]
and a
call z, Evolution_ReloadTilesetTilePatterns
ld a, [wd11e]
dec a
ld c, a
ld b, FLAG_SET
ld hl, wPokedexOwned
push bc
call Evolution_FlagAction
pop bc
ld hl, wPokedexSeen
call Evolution_FlagAction
pop de
pop hl
ld a, [wLoadedMonSpecies]
ld [hl], a
push hl
ld l, e
ld h, d
jr .nextEvoEntry2
.nextEvoEntry1
inc hl
.nextEvoEntry2
inc hl
jp .evoEntryLoop
.done
pop de
pop bc
pop hl
pop af
ld [hTilesetType], a
ld a, [wLinkState]
cp LINK_STATE_TRADING
ret z
ld a, [wIsInBattle]
and a
ret nz
ld a, [wEvolutionOccurred]
and a
call nz, PlayDefaultMusic
ret
RenameEvolvedMon:
; Renames the mon to its new, evolved form's standard name unless it had a
; nickname, in which case the nickname is kept.
ld a, [wd0b5]
push af
ld a, [wMonHIndex]
ld [wd0b5], a
call GetName
pop af
ld [wd0b5], a
ld hl, wcd6d
ld de, wcf4b
.compareNamesLoop
ld a, [de]
inc de
cp [hl]
inc hl
ret nz
cp "@"
jr nz, .compareNamesLoop
ld a, [wWhichPokemon]
ld bc, NAME_LENGTH
ld hl, wPartyMonNicks
call AddNTimes
push hl
call GetName
ld hl, wcd6d
pop de
jp CopyData
CancelledEvolution:
ld hl, StoppedEvolvingText
call PrintText
call ClearScreen
pop hl
call Evolution_ReloadTilesetTilePatterns
jp Evolution_PartyMonLoop
EvolvedText:
TX_FAR _EvolvedText
db "@"
IntoText:
TX_FAR _IntoText
db "@"
StoppedEvolvingText:
TX_FAR _StoppedEvolvingText
db "@"
IsEvolvingText:
TX_FAR _IsEvolvingText
db "@"
Evolution_ReloadTilesetTilePatterns:
ld a, [wLinkState]
cp LINK_STATE_TRADING
ret z
jp ReloadTilesetTilePatterns
LearnMoveFromLevelUp:
ld a, [wd11e] ; species
ld [wcf91], a
dec a
ld b, 0
ld c, a
ld hl, EvosMovesPointerTable
add hl, bc
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
.skipEvolutionDataLoop ; loop to skip past the evolution data, which comes before the move data
ld a, [hli]
and a ; have we reached the end of the evolution data?
jr nz, .skipEvolutionDataLoop ; if not, jump back up
.learnSetLoop ; loop over the learn set until we reach a move that is learnt at the current level or the end of the list
ld a, [hli]
and a ; have we reached the end of the learn set?
jr z, .done ; if we've reached the end of the learn set, jump
ld b, a ; level the move is learnt at
ld a, [wCurEnemyLVL]
cp b ; is the move learnt at the mon's current level?
ld a, [hli] ; move ID
jr nz, .learnSetLoop
push hl
ld d, a ; ID of move to learn
ld hl, wPartyMon1Moves
ld a, [wWhichPokemon]
ld bc, wPartyMon2 - wPartyMon1
call AddNTimes
ld b, NUM_MOVES
.checkCurrentMovesLoop ; check if the move to learn is already known
ld a, [hli]
cp d
jr z, .has_move ; if already known, jump
dec b
jr nz, .checkCurrentMovesLoop
; learn move
ld a, d
ld [wMoveNum], a
ld [wd11e], a
call GetMoveName
call CopyStringToCF4B
predef LearnMove
.has_move
pop hl
jr .learnSetLoop
.done
ld a, [wcf91]
ld [wd11e], a
ret
; writes the moves a mon has at level [wCurEnemyLVL] to [de]
; move slots are being filled up sequentially and shifted if all slots are full
WriteMonMoves:
call GetPredefRegisters
push hl
push de
push bc
ld hl, EvosMovesPointerTable
ld b, 0
ld a, [wcf91] ; cur mon ID
dec a
add a
rl b
ld c, a
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
.skipEvoEntriesLoop
ld a, [hli]
and a
jr nz, .skipEvoEntriesLoop
jr .firstMove
.nextMove
pop de
.nextMove2
inc hl
.firstMove
ld a, [hli] ; read level of next move in learnset
and a
jp z, .done ; end of list
ld b, a
ld a, [wCurEnemyLVL]
cp b
jp c, .done ; mon level < move level (assumption: learnset is sorted by level)
ld a, [wLearningMovesFromDayCare]
and a
jr z, .skipMinLevelCheck
ld a, [wDayCareStartLevel]
cp b
jr nc, .nextMove2 ; min level >= move level
.skipMinLevelCheck
; check if the move is already known
push de
ld c, NUM_MOVES
.alreadyKnowsCheckLoop
ld a, [de]
inc de
cp [hl]
jr z, .nextMove
dec c
jr nz, .alreadyKnowsCheckLoop
; try to find an empty move slot
pop de
push de
ld c, NUM_MOVES
.findEmptySlotLoop
ld a, [de]
and a
jr z, .writeMoveToSlot2
inc de
dec c
jr nz, .findEmptySlotLoop
; no empty move slots found
pop de
push de
push hl
ld h, d
ld l, e
call WriteMonMoves_ShiftMoveData ; shift all moves one up (deleting move 1)
ld a, [wLearningMovesFromDayCare]
and a
jr z, .writeMoveToSlot
; shift PP as well if learning moves from day care
push de
ld bc, wPartyMon1PP - (wPartyMon1Moves + 3)
add hl, bc
ld d, h
ld e, l
call WriteMonMoves_ShiftMoveData ; shift all move PP data one up
pop de
.writeMoveToSlot
pop hl
.writeMoveToSlot2
ld a, [hl]
ld [de], a
ld a, [wLearningMovesFromDayCare]
and a
jr z, .nextMove
; write move PP value if learning moves from day care
push hl
ld a, [hl]
ld hl, wPartyMon1PP - wPartyMon1Moves
add hl, de
push hl
dec a
ld hl, Moves
ld bc, MoveEnd - Moves
call AddNTimes
ld de, wBuffer
ld a, BANK(Moves)
call FarCopyData
ld a, [wBuffer + 5]
pop hl
ld [hl], a
pop hl
jr .nextMove
.done
pop bc
pop de
pop hl
ret
; shifts all move data one up (freeing 4th move slot)
WriteMonMoves_ShiftMoveData:
ld c, NUM_MOVES - 1
.loop
inc de
ld a, [de]
ld [hli], a
dec c
jr nz, .loop
ret
Evolution_FlagAction:
predef_jump FlagActionPredef
PrepareRelearnableMoveList:
; Loads relearnable move list to wRelearnableMoves.
; Input: party mon index = [wWhichPokemon]
ld a, [wWhichPokemon]
ld c, a
ld b, 0
ld hl, wPartySpecies
add hl, bc
ld a, [hl] ; a = mon id
ld [wd0b5], a
call GetMonHeader
ld a, [wWhichPokemon]
ld hl, wPartyMon1Moves
ld bc, wPartyMon2 - wPartyMon1
call AddNTimes
ld d, h
ld e, l
ld hl, wMonHMoves
; Write list of relearnable moves, while keeping count along the way.
; de = pointer to mon's currently-known moves
; hl = pointer to moves data for our mon
ld c, 0 ; c = count of relearnable moves
.baseMoveloop
ld a, [hli]
and a
jr z, .done
push bc
ld b, a
; Check if move is already known by our mon.
push de
ld a, [de]
cp b
jr z, .knowsBaseMove
inc de
ld a, [de]
cp b
jr z, .knowsBaseMove
inc de
ld a, [de]
cp b
jr z, .knowsBaseMove
inc de
ld a, [de]
cp b
jr z, .knowsBaseMove
.relearnableBaseMove
pop de
push hl
; Add move to the list, and update the running count.
ld a, b
ld b, 0
ld hl, wRelearnableMoves + 1
add hl, bc
ld [hl], a
pop hl
pop bc
inc c
jr .baseMoveloop
.knowsBaseMove
pop de
pop bc
jr .baseMoveloop
.done
ld b, 0
ld hl, wRelearnableMoves + 1
add hl, bc
ld a, $ff
ld [hl], a
ld hl, wRelearnableMoves
ld [hl], c
call PrepareRelearnableEvoMoves
ret
PrepareRelearnableEvoMoves:
; Get mon id.
ld a, [wWhichPokemon]
ld c, a
ld b, 0
ld hl, wPartySpecies
add hl, bc
ld a, [hl] ; a = mon id
; Get pointer to evos moves data.
dec a
ld c, a
ld b, 0
ld hl, EvosMovesPointerTable
add hl, bc
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a ; hl = pointer to evos moves data for our mon
push hl
; Get pointer to mon's currently-known moves.
ld a, [wWhichPokemon]
ld hl, wPartyMon1Level
ld bc, wPartyMon2 - wPartyMon1
call AddNTimes
ld a, [hl]
ld b, a
push bc
ld a, [wWhichPokemon]
ld hl, wPartyMon1Moves
ld bc, wPartyMon2 - wPartyMon1
call AddNTimes
pop bc
ld d, h
ld e, l
pop hl
; Skip over evolution data.
.skipEvoEntriesLoop
ld a, [hli]
and a
jr nz, .skipEvoEntriesLoop
; Write list of relearnable moves, while keeping count along the way.
; de = pointer to mon's currently-known moves
; hl = pointer to moves data for our mon
; b = mon's level
ld a, [wRelearnableMoves]
ld c, a ; c = count of relearnable moves
.evoMovesLoop
ld a, [hli]
and a
jr z, .done
cp b
jr c, .addEvoMove
jr nz, .done
.addEvoMove
push bc
ld a, [hli] ; move id
ld b, a
; Check if move is already known by our mon.
push de
ld a, [de]
cp b
jr z, .knowsEvoMove
inc de
ld a, [de]
cp b
jr z, .knowsEvoMove
inc de
ld a, [de]
cp b
jr z, .knowsEvoMove
inc de
ld a, [de]
cp b
jr z, .knowsEvoMove
.relearnableEvoMove
pop de
push hl
; Add move to the list, and update the running count.
ld a, b
ld b, 0
ld hl, wRelearnableMoves + 1
add hl, bc
ld [hl], a
pop hl
pop bc
inc c
jr .evoMovesLoop
.knowsEvoMove
pop de
pop bc
jr .evoMovesLoop
.done
ld b, 0
ld hl, wRelearnableMoves + 1
add hl, bc
ld a, $ff
ld [hl], a
ld hl, wRelearnableMoves
ld [hl], c
ret
INCLUDE "data/evos_moves.asm"
| 18.472384 | 120 | 0.702652 | [
"MIT"
] | ETDV-TheVoid/pokemon-rgb-enhanced | engine/evos_moves.asm | 12,709 | Assembly |
; A105023: a(n) = A102370(n) - n. Or, 2*A103185(n).
; Submitted by Jamie Morken(w4)
; 0,2,4,2,0,10,4,2,0,2,4,2,16,10,4,2,0,2,4,2,0,10,4,2,0,2,4,34,16,10,4,2,0,2,4,2,0,10,4,2,0,2,4,2,16,10,4,2,0,2,4,2,0,10,4,2,0,2,68,34,16,10,4,2,0,2,4,2,0,10,4,2,0,2,4,2,16,10,4,2,0,2,4,2,0,10,4,2,0,2,4,34,16,10,4
add $0,1
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
| 22.6 | 213 | 0.535398 | [
"Apache-2.0"
] | ckrause/loda-programs | oeis/105/A105023.asm | 452 | Assembly |
;-------------------------------------------------------------------------------
; 8051_EXTMEM_DUMP
;
; - Fichero que contiene el código fuente del programa.
;
;-------------------------------------------------------------------------------
; Copyright (c) 2022 Jorge Botana Mtz. de Ibarreta
;
; Este archivo se encuentra bajo los términos de la Licencia MIT. Debería
; haberse proporcionado una copia de ella junto a este fichero. Si no es así, se
; puede encontrar en el siguiente enlace:
;
; https://opensource.org/licenses/MIT
;-------------------------------------------------------------------------------
;---------------------------------- SÍMBOLOS -----------------------------------
;-------------------------------------------------------------------------------
; Parámetros de configuración.
;-------------------------------------------------------------------------------
INIT_ADDR EQU 0000h ; Dirección de la memoria externa a
; partir de la cual se va a realizar el
; volcado.
N_BYTES EQU 512 ; Número total de bytes que se van a
; volcar de la memoria externa. En caso
; de que se vayan a volcar los 64 KB,
; (65536 bytes), ha de introducirse un
; 0.
N_COLS EQU 16 ; Número de bytes volcados que se van a
; representar en cada fila (máximo 99).
IS_RAM EQU 1 ; Valor que especifica si la memoria
; externa es una RAM (1) o una ROM (0).
TEST_MODE EQU 1 ; Valor que especifica, en caso de que
; la memoria externa sea una RAM, si el
; programa va a copiar en ella (1) o no
; (0) el mensaje de pruebas a partir de
; de la misma dirección donde va a
; comenzar el volcado.
UC_ROM EQU 2000h ; Valor que especifica, en caso de que
; la memoria externa sea una ROM, cual
; es su primera dirección accesible por
; el microcontrolador usado, determinada
; por la cantidad de memoria ROM interna
; que contiene este (esto se debe a que,
; estando a nivel alto el pin de acceso
; externo, los accesos a memoria de
; código se llevan a cabo dentro de la
; memoria ROM interna, a menos que la
; dirección accedida no exista dentro de
; la memoria ROM interna, en cuyo caso
; se accede a esa misma dirección en la
; memoria ROM externa).
;-------------------------------------------------------------------------------
; Definiciones adicionales.
;-------------------------------------------------------------------------------
BUFF EQU 0Fh ; Dirección inicial del puntero usado
; para almacenar temporalmente en la
; memoria RAM interna (en un buffer) los
; caracteres ASCII de una fila, para
; transmitirlos por el puerto serie a
; continuación de los caracteres HEX (se
; usan registros situados entre 00h y
; 07h, y la pila siempre va a caber
; entre 08h y 0Fh, pudiendo guardar los
; caracteres ASCII a continuación).
END_ADDR EQU INIT_ADDR + N_BYTES ; Dirección de la memoria externa donde
; finaliza el volcado.
;-------------------------------------------------------------------------------
; Comprobación de errores de configuración (precaución, algunos ensambladores
; aceptan valores de más de dos bytes, pero luego solo evalúan los dos últimos,
; interpretando por ejemplo un 65540 como un 4, y por esa razón con estos
; ensambladores no se puede comprobar en el programa si se introdujo
; erróneamente un valor superior a 65535, mientras que con otros ensambladores
; no es necesario hacerlo porque se generaría un error en el momento en el que
; se declara un símbolo con un valor prohibido).
;-------------------------------------------------------------------------------
IF N_COLS < 1 OR N_COLS > 99
__ERROR__ "N_COLS must be between 1 and 99."
ENDIF ; N_COLS < 1 OR N_COLS > 99
IF IS_RAM <> 0 AND IS_RAM <> 1
__ERROR__ "IS_RAM must be 0 or 1."
ENDIF ; IS_RAM <> 0 AND IS_RAM <> 1
IF TEST_MODE <> 0 AND TEST_MODE <> 1
__ERROR__ "TEST_MODE must be 0 or 1."
ENDIF ; TEST_MODE <> 0 AND TEST_MODE <> 1
IF INIT_ADDR > END_ADDR - 1
__ERROR__ "Overflows are not allowed (from 0xFFFF to 0x0000)."
ENDIF ; INIT_ADDR > END_ADDR - 1
IF INIT_ADDR < UC_ROM AND IS_RAM = 0
__ERROR__ "Unaddressable external ROM address."
ENDIF ; INIT_ADDR < UC_ROM AND IS_RAM = 0
;-------------------------------------------------------------------------------
; Caracteres HEX correspondientes a los dígitos de la dirección de la memoria
; externa a partir de la cual se va a realizar el volcado.
;-------------------------------------------------------------------------------
IF INIT_ADDR / 4096 < 10
A_4096 EQU INIT_ADDR / 4096 + '0'
ELSE ; INIT_ADDR / 4096 < 10
A_4096 EQU INIT_ADDR / 4096 + '7'
ENDIF ; INIT_ADDR / 4096 < 10
IF (INIT_ADDR MOD 4096) / 256 < 10
A_256 EQU (INIT_ADDR MOD 4096) / 256 + '0'
ELSE ; (INIT_ADDR MOD 4096) / 256 < 10
A_256 EQU (INIT_ADDR MOD 4096) / 256 + '7'
ENDIF ; (INIT_ADDR MOD 4096) / 256 < 10
IF ((INIT_ADDR MOD 4096) MOD 256) / 16 < 10
A_16 EQU ((INIT_ADDR MOD 4096) MOD 256) / 16 + '0'
ELSE ; ((INIT_ADDR MOD 4096) MOD 256) / 16 < 10
A_16 EQU ((INIT_ADDR MOD 4096) MOD 256) / 16 + '7'
ENDIF ; ((INIT_ADDR MOD 4096) MOD 256) / 16 < 10
IF (((INIT_ADDR MOD 4096) MOD 256) MOD 16) / 1 < 10
A_1 EQU (((INIT_ADDR MOD 4096) MOD 256) MOD 16) / 1 + '0'
ELSE ; (((INIT_ADDR MOD 4096) MOD 256) MOD 16) / 1 < 10
A_1 EQU (((INIT_ADDR MOD 4096) MOD 256) MOD 16) / 1 + '7'
ENDIF ; (((INIT_ADDR MOD 4096) MOD 256) MOD 16) / 1 < 10
;-------------------------------------------------------------------------------
; Caracteres DEC correspondientes a los dígitos del número total de bytes que se
; van a volcar de la memoria externa.
;-------------------------------------------------------------------------------
B_10K EQU N_BYTES / 10000 + '0'
B_1K EQU (N_BYTES MOD 10000) / 1000 + '0'
B_100 EQU ((N_BYTES MOD 10000) MOD 1000) / 100 + '0'
B_10 EQU (((N_BYTES MOD 10000) MOD 1000) MOD 100) / 10 + '0'
B_1 EQU ((((N_BYTES MOD 10000) MOD 1000) MOD 100) MOD 10) / 1 + '0'
;-------------------------------------------------------------------------------
; Caracteres DEC correspondientes a los dígitos del número de bytes volcados que
; se van a representar en cada fila.
;-------------------------------------------------------------------------------
C_10 EQU (((N_COLS MOD 10000) MOD 1000) MOD 100) / 10 + '0'
C_1 EQU ((((N_COLS MOD 10000) MOD 1000) MOD 100) MOD 10) / 1 + '0'
;----------------------------- PROGRAMA PRINCIPAL ------------------------------
;-------------------------------------------------------------------------------
; Inicializa el programa:
;
; - Copia el mensaje de pruebas a la memoria externa, en caso de que sea una RAM
; y que esta operación esté habilitada.
;
; - Configura los periféricos (los temporizadores / contadores y el puerto
; serie).
;
; - Transmite por el puerto serie los mensajes iniciales que muestran la
; configuración actual del programa.
;
; - Realiza en el lazo sin fin un polling de las banderas usadas para que,
; cuando sean activadas, se lleven a cabo sus tareas asociadas (deshabilitar o
; habilitar el pulsador y volcar la memoria externa).
;-------------------------------------------------------------------------------
IF IS_RAM = 1 AND TEST_MODE = 1
STR_COPY:
MOV DPTR,#TEST_MSG ; Carga en el DPTR la dirección de la
; memoria de código donde comienza el
; mensaje de pruebas.
MOV R7,DPH ; Guarda en R7 el DPH del DPTR, que
; contiene el MSB de la dirección de la
; memoria de código donde comienza el
; mensaje de pruebas.
MOV R6,DPL ; Guarda en R6 el DPL del DPTR, que
; contiene el LSB de la dirección de la
; memoria de código donde comienza el
; mensaje de pruebas.
MOV DPTR,#INIT_ADDR ; Carga en el DPTR la dirección de la
; memoria RAM externa a partir de la
; cual se va a copiar el mensaje de
; pruebas.
MOV R5,DPH ; Guarda en R5 el DPH del DPTR, que
; contiene el MSB de la dirección de la
; memoria RAM externa a partir de la
; cual se va a copiar el mensaje de
; pruebas.
MOV R4,DPL ; Guarda en R4 el DPL del DPTR, que
; contiene el LSB de la dirección de la
; memoria RAM externa a partir de la
; cual se va a copiar el mensaje de
; pruebas.
CHAR_COPY:
MOV DPH,R7 ; Restaura de R7 al DPH del DPTR el MSB
; de la dirección de la memoria de
; código del carácter actual del mensaje
; de pruebas que se va a copiar a la
; memoria RAM externa.
MOV DPL,R6 ; Restaura de R6 al DPL del DPTR el LSB
; de la dirección de la memoria de
; código del carácter actual del mensaje
; de pruebas que se va a copiar a la
; memoria RAM externa.
CLR A ; Borra el acumulador para apuntar al
; carácter correcto en la siguiente
; instrucción.
MOVC A,@A+DPTR ; Copia al acumulador el carácter actual
; del mensaje de pruebas.
INC DPTR ; Incrementa el DPTR para apuntar al
; siguiente carácter del mensaje de
; pruebas en la memoria de código.
MOV R7,DPH ; Guarda en R7 el DPH del DPTR, que
; contiene el MSB de la dirección de la
; memoria de código del siguiente
; carácter del mensaje de pruebas que se
; va a copiar a la memoria RAM externa.
MOV R6,DPL ; Guarda en R6 el DPL del DPTR, que
; contiene el LSB de la dirección de la
; memoria de código del siguiente
; carácter del mensaje de pruebas que se
; va a copiar a la memoria RAM externa.
MOV DPH,R5 ; Restaura de R5 al DPH del DPTR el MSB
; de la dirección de la memoria RAM
; externa donde se va a copiar el
; carácter actual del mensaje de
; pruebas.
MOV DPL,R4 ; Restaura de R4 al DPL del DPTR el LSB
; de la dirección de la memoria RAM
; externa donde se va a copiar el
; carácter actual del mensaje de
; pruebas.
MOVX @DPTR,A ; Copia a la memoria RAM externa el
; carácter actual del mensaje de
; pruebas, contenido en el acumulador.
INC DPTR ; Incrementa el DPTR para apuntar adonde
; se copiará en la memoria RAM externa
; el siguiente carácter del mensaje de
; pruebas.
MOV R5,DPH ; Guarda en R5 el DPH del DPTR, que
; contiene el MSB de la dirección de la
; memoria RAM externa donde se va copiar
; el siguiente carácter del mensaje de
; pruebas.
MOV R4,DPL ; Guarda en R4 el DPL del DPTR, que
; contiene el LSB de la dirección de la
; memoria RAM externa donde se va copiar
; el siguiente carácter del mensaje de
; pruebas.
CJNE A,#0,CHAR_COPY ; Repite el ciclo hasta copiar todos los
; caracteres del mensaje de pruebas, es
; decir, hasta leer el 0 que marca el
; final de la cadena de caracteres.
ENDIF ; IS_RAM = 1 AND TEST_MODE = 1
PERIPHERALS_SETUP:
MOV TMOD,#00100110B ; Configura los temporizadores /
; contadores en modo 2 (8 bits con
; autorrecarga), el 0 como contador
; (usado por el pulsador, conectado al
; pin de entrada externa P3.4/T0) y el 1
; como temporizador (usado para generar
; el baudrate del puerto serie).
MOV TH0,#-1 ; Establece el valor de recarga del
; contador para que, al accionar el
; pulsador una sola vez, se active
; automáticamente la bandera de
; desbordamiento y se lleve a cabo el
; proceso de volcado de la memoria
; externa.
MOV TL0,#-1 ; Recarga manualmente el contador (solo
; es necesario hacerlo la primera vez,
; ya que cuenta con autorrecarga).
MOV TH1,#-3 ; Establece el valor de recarga del
; temporizador para obtener un baudrate
; de 9600 para el puerto serie.
MOV TL1,#-3 ; Recarga manualmente el temporizador
; (solo es necesario hacerlo la primera
; vez, ya que cuenta con autorrecarga).
SETB TR0 ; Habilita la ejecución del contador,
; para que incremente su cuenta al
; detectar un flanco de bajada en
; P3.4/T0, al accionar el pulsador.
SETB TR1 ; Habilita la ejecución del
; temporizador, comenzando la
; generación del baudrate del puerto
; serie.
MOV SCON,#01010000B ; Configura el puerto serie en modo 1
; (UART de 8 bits) con el receptor
; habilitado.
INITIALIZATION:
MOV DPTR,#SETUP_MSG ; Carga en el DPTR la dirección de la
; memoria de código donde comienza el
; mensaje que muestra la configuración
; actual del programa.
ACALL STR_TX ; Transmite por el puerto serie el
; mensaje que muestra la configuración
; actual del programa.
MOV DPTR,#ADDR_MSG ; Carga en el DPTR la dirección de la
; memoria de código donde comienza el
; mensaje que muestra la dirección de la
; memoria externa a partir de la cual se
; va a realizar el volcado.
ACALL STR_TX ; Transmite por el puerto serie el
; mensaje que muestra la dirección de la
; memoria externa a partir de la cual se
; va a realizar el volcado.
MOV DPTR,#BYTES_MSG ; Carga en el DPTR la dirección de la
; memoria de código donde comienza el
; mensaje que muestra el número total de
; bytes que se van a volcar de la
; memoria externa.
ACALL STR_TX ; Transmite por el puerto serie el
; mensaje que muestra el número total de
; bytes que se van a volcar de la
; memoria externa.
MOV DPTR,#COLS_MSG ; Carga en el DPTR la dirección de la
; memoria de código donde comienza el
; mensaje que muestra el número de bytes
; volcados que se van a representar en
; cada fila.
ACALL STR_TX ; Transmite por el puerto serie el
; mensaje que muestra el número de bytes
; volcados que se van a representar en
; cada fila.
MOV DPTR,#TYPE_MSG ; Carga en el DPTR la dirección de la
; memoria de código donde comienza el
; mensaje que especifica si la memoria
; externa es una RAM o una ROM.
ACALL STR_TX ; Transmite por el puerto serie el
; mensaje que especifica si la memoria
; externa es una RAM o una ROM.
IF IS_RAM = 1
MOV DPTR,#MODE_MSG ; Carga en el DPTR la dirección de la
; memoria de código donde comienza el
; mensaje que especifica si el programa
; ha copiado o no el mensaje de pruebas
; en la memoria RAM externa.
ACALL STR_TX ; Transmite por el puerto serie el
; mensaje que especifica si el programa
; ha copiado o no el mensaje de pruebas
; en la memoria RAM externa.
ENDIF ; IS_RAM = 1
MOV DPTR,#READY_MSG ; Carga en el DPTR la dirección de la
; memoria de código donde comienza el
; mensaje que indica que el programa ya
; se ha inicializado.
ACALL STR_TX ; Transmite por el puerto serie el
; mensaje que indica que el programa ya
; se ha inicializado.
ACALL CRLF_TX ; Transmite por el puerto serie una
; nueva línea adicional.
INFINITELY_LOOP:
JB RI,CHAR_RX ; Inspecciona el estado de la bandera
; del puerto serie que se activa cuando
; se recibe un carácter, para
; posteriormente llevar a cabo la
; deshabilitación o habilitación del
; pulsador.
JB TF0,EXTMEM_DUMP ; Inspecciona el estado de la bandera de
; desbordamiento del contador que se
; activa automáticamente cuando el
; pulsador es accionado, para
; posteriormente llevar a cabo el
; volcado de la memoria externa.
SJMP INFINITELY_LOOP ; Repite en bucle el lazo sin fin.
;-------------------------------------------------------------------------------
; Deshabilita o habilita el pulsador, si corresponde.
;-------------------------------------------------------------------------------
CHAR_RX:
MOV A,SBUF ; Copia al acumulador el carácter
; recibido por el puerto serie,
; contenido en el SBUF.
JNB TR0,ENABLE ; Inspecciona el estado de la bandera de
; habilitación del contador para
; determinar si el pulsador está
; deshabilitado o habilitado. Si está
; deshabilitado, el programa sigue en la
; siguiente instrucción para habilitar
; el pulsador si se ha recibido un
; carácter '2' por el puerto serie,
; mientras que si está habilitado el
; programa salta a la instrucción a
; partir de la cual se deshabilita el
; pulsador si se ha recibido un carácter
; '1' por el puerto serie.
DISABLE:
CJNE A,#'1',RETURN ; Comprueba si se ha recibido un
; carácter '1' por el puerto serie. Si
; es así, se deshabilita el pulsador, y
; de no ser así se salta este proceso,
; al omitir las siguientes
; instrucciones.
CLR TR0 ; Deshabilita el pulsador al desactivar
; la bandera de habilitación del
; contador.
MOV DPTR,#DIS_MSG ; Carga en el DPTR la dirección de la
; memoria de código donde comienza el
; mensaje que notifica de que el
; pulsador ha sido deshabilitado.
SJMP NOTIFY ; Salta a la instrucción que notifica de
; los cambios.
ENABLE:
CJNE A,#'2',RETURN ; Comprueba si se ha recibido un
; carácter '2' por el puerto serie. Si
; es así, se habilita el pulsador, y de
; no ser así se salta este proceso, al
; omitir las siguientes instrucciones.
SETB TR0 ; Habilita el pulsador al activar la
; bandera de habilitación del contador.
MOV DPTR,#EN_MSG ; Carga en el DPTR la dirección de la
; memoria de código donde comienza el
; mensaje que notifica de que el
; pulsador ha sido habilitado.
NOTIFY:
ACALL STR_TX ; Transmite por el puerto serie el
; mensaje que notifica de que el
; pulsador ha sido deshabilitado o
; habilitado.
ACALL CRLF_TX ; Transmite por el puerto serie una
; nueva línea adicional.
RETURN:
CLR RI ; Desactiva manualmente la bandera de
; recepción del puerto serie para que
; las instrucciones anteriores no se
; ejecuten de nuevo tras regresar al
; lazo sin fin, a menos que se reciba
; otro carácter.
AJMP INFINITELY_LOOP ; Regresa al lazo sin fin.
;-------------------------------------------------------------------------------
; Realiza el volcado de la memoria externa al accionar el pulsador y luego
; espera a que este vuelva a la posición de reposo (es decir, sin accionar)
; antes de regresar a lazo sin fin, evitando de esa forma que se repita el
; proceso sin accionar el pulsador nuevamente, debido a los rebotes. Para ello
; se hace uso de un mecanismo antirrebotes que funciona realizando un muestreo
; cada 2 milisegundos (aproximadamente) del nivel del tensión del pin al que
; está conectado el pulsador (P3.4/T0), no finalizando hasta que detecte 8 veces
; seguidas un nivel de tensión alto (para que hayan desaparecido los rebotes).
;
; Delay de 2 milisegundos por software (con un oscilador de 11,0592 MHz):
;
; T_osc_cyc = 1 / f_osc_cyc =
; = 1 / [11,0592 * 10^6 (Hz*osc_cyc)] = 9,04 * 10^(-8) (s/osc_cyc)
;
; T_mch_cyc = 12 (osc_cyc/mch_cyc) * T_osc_cyc =
; = 12 (osc_cyc/mch_cyc) * 9,04 * 10^(-8) (s/osc_cyc) = 1,08 * 10^(-6)
; (s/mch_cyc)
;
; N_mch_cyc = 2 * 10^(-3) (s/del) / T_mch_cyc =
; = 2 * 10^(-3) (s/del) / 1,08 * 10^(-6) (s/mch_cyc) = 1843,2
; (mch_cyc/del)
;-------------------------------------------------------------------------------
EXTMEM_DUMP:
MOV DPTR,#HEADER_MSG ; Carga en el DPTR la dirección de la
; memoria de código donde comienza el
; mensaje inicial del volcado de la
; memoria externa.
ACALL STR_TX ; Transmite por el puerto serie el
; mensaje inicial del volcado de la
; memoria externa.
MOV DPTR,#INIT_ADDR ; Carga en el DPTR la dirección de la
; memoria externa a partir de la cual va
; a llevarse cabo el volcado.
ROW_TX:
MOV R0,#BUFF ; Copia a R0 la dirección inicial del
; puntero que almacena temporalmente en
; un buffer en la memoria RAM interna
; los caracteres ASCII de la fila
; actual, para transmitirlos por el
; puerto serie a continuación de los
; caracteres HEX.
MOV A,#'0' ; Copia al acumulador el carácter '0'.
ACALL CHAR_TX ; Transmite por el puerto serie el
; carácter '0'.
MOV A,#'x' ; Copia al acumulador el carácter 'x'.
ACALL CHAR_TX ; Transmite por el puerto serie el
; carácter 'x'.
OFFSET_MSB_TX:
MOV A,DPH ; Copia al acumulador el DPH del DPTR,
; que contiene el MSB de la dirección de
; offset de la fila actual.
ACALL BYTE_TX ; Transmite por el puerto serie el MSB
; de la dirección de offset de la fila
; actual tras convertir sus nibbles a
; caracteres HEX (p.e. 4Ah -> '4A').
OFFSET_LSB_TX:
MOV A,DPL ; Copia al acumulador el DPL del DPTR,
; que contiene el LSB de la dirección de
; offset de la fila actual.
ACALL BYTE_TX ; Transmite por el puerto serie el LSB
; de la dirección de offset de la fila
; actual tras convertir sus nibbles a
; caracteres HEX (p.e. 07h -> '07').
MOV A,#':' ; Copia al acumulador el carácter ':'.
ACALL CHAR_TX ; Transmite por el puerto serie el
; carácter ':'.
HEX_STR_TX:
ACALL BLANK_TX ; Transmite por el puerto serie un
; espacio en blanco para mantener una
; separación entre los bytes volcados.
INC R0 ; Incrementa R0 para almacenar el
; carácter ASCII actual en la siguiente
; posición del buffer.
JNB F0,HEX_CHAR_TX ; Inspecciona la bandera que se activa
; cuando se vuelca el último byte
; deseado. Si está desactivada, el
; programa continúa volcando el
; siguiente byte, mientras que en caso
; contrario rellena con espacios en
; blanco el espacio restante de la
; última fila.
ACALL BLANK_TX ; Transmite por el puerto serie un
; espacio en blanco en la posición
; donde iría el primer carácter HEX de
; un byte volcado.
ACALL BLANK_TX ; Transmite por el puerto serie un
; espacio en blanco en la posición
; donde iría el segundo carácter HEX de
; un byte volcado.
MOV @R0,A ; Guarda en el buffer el carácter del
; espacio en blanco que fue almacenado
; en el acumulador en la instrucción
; anterior.
SJMP ASCII_STR_TX ; Salta las siguientes instrucciones.
HEX_CHAR_TX:
IF IS_RAM = 1
MOVX A,@DPTR ; Copia al acumulador el byte actual
; volcado de la memoria RAM externa.
ELSE ; IS_RAM = 1
CLR A ; Borra el acumulador para apuntar al
; carácter correcto en la siguiente
; instrucción.
MOVC A,@A+DPTR ; Copia al acumulador el byte actual
; volcado de la memoria ROM externa.
ENDIF ; IS_RAM = 1
MOV @R0,A ; Guarda en el buffer el byte actual
; volcado.
ACALL BYTE_TX ; Transmite por el puerto serie los
; caracteres HEX correspondientes al
; byte actual volcado.
INC DPTR ; Incrementa el DPTR para apuntar al
; siguiente byte de la memoria externa.
MOV A,DPH ; Copia al acumulador el DPH del DPTR,
; que contiene el MSB de la dirección de
; la memoria externa que contiene el
; siguiente byte que se va a volcar.
CJNE A,#HIGH(END_ADDR),ASCII_STR_TX ; Salta las siguientes instrucciones si
; se sabe con certeza que no se han
; volcado todos los bytes deseados.
MOV A,DPL ; Copia al acumulador el DPL del DPTR,
; que contiene el LSB de la dirección de
; la memoria externa que contiene el
; siguiente byte que se va a volcar.
CJNE A,#LOW(END_ADDR),ASCII_STR_TX ; Salta la siguiente instrucción si no
; se han volcado todos los bytes
; deseados.
SETB F0 ; Activa una bandera si ya se ha
; volcado el último byte. Por ejemplo,
; si se van a volcar los primeros 256
; bytes, se vuelcan los bytes desde el 0
; hasta el 255, ambos incluidos, y este
; último es el 00FFh. Al incrementar el
; DPTR pasa a valer 0100h = 256, que
; corresponde al 257avo byte, que no se
; va a llegar a volcar porque se llega
; a este punto, donde se activa la
; bandera.
ASCII_STR_TX:
CJNE R0,#BUFF+N_COLS,HEX_STR_TX ; Repite el ciclo hasta completar la
; fila actual.
ACALL BLANK_TX ; Transmite por el puerto serie un
; primer espacio en blanco para separar
; los caracteres HEX de los ASCII.
ACALL BLANK_TX ; Transmite por el puerto serie un
; segundo espacio en blanco para separar
; los caracteres HEX de los ASCII.
ACALL BLANK_TX ; Transmite por el puerto serie un
; tercer espacio en blanco para separar
; los caracteres HEX de los ASCII.
ACALL BLANK_TX ; Transmite por el puerto serie un
; cuarto espacio en blanco para separar
; los caracteres HEX de los ASCII.
MOV R0,#BUFF ; Restaura R0 a la posición inicial
; para, en la siguiente instrucción,
; apuntar al primer carácter ASCII
; almacenado.
ASCII_CHAR_TX:
INC R0 ; Incrementa R0 para restaurar el
; siguiente carácter ASCII almacenado.
MOV A,@R0 ; Restaura el carácter ASCII copiándolo
; al acumulador.
ACALL CHAR_TX ; Transmite por el puerto serie el
; carácter ASCII restaurado.
ACALL BLANK_TX ; Transmite por el puerto serie un
; espacio en blanco para mantener una
; separación con el siguiente carácter
; ASCII.
CJNE R0,#BUFF+N_COLS,ASCII_CHAR_TX ; Repite el ciclo hasta completar la
; fila.
ACALL CRLF_TX ; Transmite por el puerto serie una
; nueva línea.
JNB F0,ROW_TX ; Comprueba si la fila que se acaba de
; transmitir por el puerto serie era la
; última, para repetir el ciclo con la
; siguiente fila en caso de que no fuera
; así.
CLR F0 ; Borra la bandera tras terminar el
; volcado de la memoria externa.
DEBOUNCE:
MOV R3,#0 ; Inicializa el contador de software del
; mecanismo antirrebotes del pulsador.
DELAY:
MOV R7,#255 ; Ejecuta 1 * 1 = 1 ciclo . N = 1
MOV R6,#255 ; Ejecuta 1 * 1 = 1 ciclo . N = 2
MOV R5,#255 ; Ejecuta 1 * 1 = 1 ciclo . N = 3
MOV R4,#155 ; Ejecuta 1 * 1 = 1 ciclo . N = 4
DJNZ R7,$ ; Ejecuta 2 * 255 = 510 ciclos. N = 514
DJNZ R6,$ ; Ejecuta 2 * 255 = 510 ciclos. N = 1024
DJNZ R5,$ ; Ejecuta 2 * 255 = 510 ciclos. N = 1534
DJNZ R4,$ ; Ejecuta 2 * 155 = 310 ciclos. N = 1844
JB T0,INCREASE ; Lee el pin P3.4/T0 para, en función de
; su nivel de tensión, incrementar o
; reiniciar el contador de software.
SJMP DEBOUNCE ; Reinicia el mecanismo antirrebotes si
; se lee un nivel bajo de tensión
; (pulsador accionado).
INCREASE:
INC R3 ; Incrementa el contador de software si
; se lee un nivel alto de tensión
; (pulsador sin accionar).
CJNE R3,#8,DELAY ; Repite el ciclo hasta que se detecte
; un nivel alto de tensión por octava
; vez consecutiva, momento para el cual
; habrán desaparecido los rebotes tras
; haber soltado el pulsador.
FINALIZE:
ACALL CRLF_TX ; Transmite por el puerto serie una
; nueva línea adicional.
MOV DPTR,#FOOTER_MSG ; Carga en el DPTR la dirección de la
; memoria de código donde comienza el
; mensaje final del volcado de la
; memoria externa.
ACALL STR_TX ; Transmite por el puerto serie el
; mensaje final del volcado de la
; memoria externa.
ACALL CRLF_TX ; Transmite por el puerto serie una
; nueva línea adicional.
CLR TF0 ; Desactiva manualmente la bandera de
; desbordamiento del contador para que
; las instrucciones anteriores no se
; ejecuten de nuevo tras regresar al
; lazo sin fin, a menos que el pulsador
; vuelva a ser accionado.
AJMP INFINITELY_LOOP ; Regresa al lazo sin fin.
;--------------------------------- SUBRUTINAS ----------------------------------
;-------------------------------------------------------------------------------
; Transmite por el puerto serie los caracteres HEX correspondientes a un byte
; contenido en el acumulador. Por ejemplo:
;
; <- 6A Entrada (un byte)
;
; B = 6A MOV B,A
; A = A6 SWAP A
; A = 06 ANL A,#00001111B
; B = 0A ANL B,#00001111B
; A = '6' MOVC A,@A+DPTR
; A = 0A MOV A,B
; A = 'A' MOVC A,@A+DPTR
;
; -> '6A' Salida (dos caracteres HEX)
;-------------------------------------------------------------------------------
BYTE_TX:
PUSH DPH ; Guarda en la pila el DPH del DPTR, ya
; que es necesario modificar su valor en
; las siguientes instrucciones y no se
; puede perder el valor que contiene
; actualmente, que es el MSB de la
; dirección de la memoria externa del
; byte que se está volcando.
PUSH DPL ; Guarda en la pila el DPL del DPTR, ya
; que es necesario modificar su valor en
; las siguientes instrucciones y no se
; puede perder el valor que contiene
; actualmente, que es el LSB de la
; dirección de la memoria externa del
; byte que se está volcando.
MOV B,A ; Copia al registro B el acumulador.
SWAP A ; Intercambia los nibbles del
; acumulador.
ANL A,#00001111B ; Borra del acumulador su nibble de
; mayor peso para que el acumulador pase
; a tomar el valor del nibble de mayor
; peso del byte original.
ANL B,#00001111B ; Borra del registro B su nibble de
; mayor peso para que el registro B pase
; a tomar el valor del nibble de menor
; peso del byte original.
MOV DPTR,#LUT ; Carga en el DPTR la dirección de la
; memoria de código a partir de la cual
; se sitúa una tabla de conversión.
MOVC A,@A+DPTR ; Copia al acumulador el carácter HEX
; correspondiente al nibble de mayor
; peso del byte que se está volcando.
ACALL CHAR_TX ; Transmite por el puerto serie el
; carácter HEX correspondiente al nibble
; de mayor peso del byte que se está
; volcando.
MOV A,B ; Copia al acumulador el registro B.
MOVC A,@A+DPTR ; Copia al acumulador el carácter HEX
; correspondiente al nibble de menor
; peso del byte que se está volcando.
ACALL CHAR_TX ; Transmite por el puerto serie el
; carácter HEX correspondiente al nibble
; de menor peso del byte que se está
; volcando.
POP DPL ; Restaura de la pila el DPL del DPTR,
; que contiene el LSB de la dirección de
; la memoria externa del byte que se
; está volcando.
POP DPH ; Restaura de la pila el DPH del DPTR,
; que contiene el MSB de la dirección de
; la memoria externa del byte que se
; está volcando.
RET ; Retorna de la llamada a la subrutina.
;-------------------------------------------------------------------------------
; Transmite por el puerto serie la cadena de caracteres a la que apunta el DPTR
; y deja una línea en blanco.
;-------------------------------------------------------------------------------
STR_TX:
CLR A ; Borra el acumulador para apuntar al
; carácter correcto en la siguiente
; instrucción.
MOVC A,@A+DPTR ; Copia al acumulador el carácter actual
; de la cadena.
ACALL CHAR_TX ; Transmite por el puerto serie el
; carácter actual de la cadena.
INC DPTR ; Incrementa el DPTR para apuntar al
; siguiente carácter de la cadena.
CJNE A,#0,STR_TX ; Comprueba si el siguiente carácter es
; el 0 que marca el final de la cadena,
; en cuyo caso el programa sigue en la
; siguiente instrucción. Si no es así,
; se repite el ciclo para transmitir el
; siguiente carácter.
ACALL CRLF_TX ; Transmite por el puerto serie una
; primera nueva línea.
ACALL CRLF_TX ; Transmite por el puerto serie una
; segunda nueva línea.
RET ; Retorna de la llamada a la subrutina.
;-------------------------------------------------------------------------------
; Transmite por el puerto serie un retorno de carro (CR) y una nueva línea (LF).
;-------------------------------------------------------------------------------
CRLF_TX:
MOV A,#13 ; Copia al acumulador el carácter del
; retorno de carro.
ACALL CHAR_TX ; Transmite por el puerto serie el
; carácter del retorno de carro.
MOV A,#10 ; Copia al acumulador el carácter de la
; nueva línea.
ACALL CHAR_TX ; Transmite por el puerto serie el
; carácter de la nueva línea.
RET ; Retorna de la llamada a la subrutina.
;-------------------------------------------------------------------------------
; Transmite por el puerto serie un espacio en blanco.
;-------------------------------------------------------------------------------
BLANK_TX:
MOV A,#' ' ; Copia al acumulador el carácter del
; espacio en blanco.
ACALL CHAR_TX ; Transmite por el puerto serie el
; carácter del espacio en blanco.
RET ; Retorna de la llamada a la subrutina.
;-------------------------------------------------------------------------------
; Transmite por el puerto serie el carácter contenido en el acumulador.
;-------------------------------------------------------------------------------
CHAR_TX:
MOV SBUF,A ; Copia al SBUF el carácter contenido en
; el acumulador.
JNB TI,$ ; Bloquea el programa hasta que la
; bandera de transmisión del puerto
; serie sea activada automáticamente,
; cuando la transmisión del carácter
; haya finalizado.
CLR TI ; Desactiva manualmente la bandera de
; transmisión del puerto serie,
; dejándola preparada para transmitir el
; siguiente carácter.
RET ; Retorna de la llamada a la subrutina.
;------------------------ MENSAJES Y TABLA DE CONSULTA -------------------------
SETUP_MSG: DB 'Current configuration:', 0
ADDR_MSG: DB ' - Base address : 0x', A_4096, A_256, A_16, A_1, 0
IF N_BYTES <> 0
BYTES_MSG: DB ' - Total bytes : ', B_10K, B_1K, B_100, B_10, B_1, 0
ELSE ; N_BYTES <> 0
BYTES_MSG: DB ' - Total bytes : 65536', 0
ENDIF ; N_BYTES <> 0
COLS_MSG: DB ' - Columns per row : ', C_10, C_1, 0
IF IS_RAM = 1
TYPE_MSG: DB ' - External memory type : RAM', 0
ELSE ; IS_RAM = 1
TYPE_MSG: DB ' - External memory type : ROM', 0
ENDIF ; IS RAM = 1
IF IS_RAM = 1
IF TEST_MODE = 1
MODE_MSG: DB ' - Preloaded test message : True', 0
ELSE ; TEST_MODE = 1
MODE_MSG: DB ' - Preloaded test message : False', 0
ENDIF ; TEST_MODE = 1
ENDIF ; IS_RAM = 1
READY_MSG: DB 'Ready.', 0
HEADER_MSG: DB 'Dump of the external memory:', 0
TEST_MSG: DB '---- TITLE -----'
DB ' '
DB '8051_EXTMEM_DUMP'
DB ' '
DB ' '
DB '- DESCRIPTION --'
DB ' '
DB 'External memory '
DB 'dump with a '
DB 'MCS-51 family uC'
DB ' '
DB ' '
DB '---- VERSION ---'
DB ' '
DB '1.0.0 '
DB ' '
DB ' '
DB '---- AUTHOR ----'
DB ' '
DB 'Jorge Botana '
DB 'Mtz. de Ibarreta'
DB ' '
DB ' '
DB '--- LANGUAGE ---'
DB ' '
DB 'MCS-51 assembly '
DB ' '
DB ' '
DB '--- LICENSE ----'
DB ' '
DB 'MIT ', 0
FOOTER_MSG: DB 'Done.', 0
DIS_MSG: DB '1 - Push-button disabled.', 0
EN_MSG: DB '2 - Push-button enabled.', 0
LUT: DB '0123456789ABCDEF'
;-------------------------------------------------------------------------------
END
| 51.619981 | 80 | 0.39139 | [
"MIT"
] | jorge-botana/8051_EXTMEM_DUMP | 8051_EXTMEM_DUMP.asm | 55,531 | Assembly |
Subsets and Splits