text stringlengths 1 1.05M |
|---|
; A129791: a(n) = ceiling(7^n/n).
; 7,25,115,601,3362,19609,117649,720601,4483735,28247525,179756977,1153440601,7453000801,48444505204,316504100663,2077058160601,13684147881601,90467422106137,599941851861745,3989613314880601
mov $1,7
mov $2,1
add $2,$0
mov $0,1
pow $1,$2
sub $1,1
mov $3,1
mul $3,$1
div $3,$2
add $3,9
lpb $0,1
mul $0,$4
mov $1,4
mul $1,$3
lpe
div $1,4
sub $1,8
|
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r13
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_A_ht+0xf25, %rdx
nop
nop
cmp $4126, %r11
mov $0x6162636465666768, %rbx
movq %rbx, %xmm5
movups %xmm5, (%rdx)
nop
and $36187, %r13
lea addresses_A_ht+0xdc45, %rsi
lea addresses_D_ht+0x4325, %rdi
clflush (%rdi)
nop
nop
and %r10, %r10
mov $16, %rcx
rep movsb
xor $48292, %r13
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %r13
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r13
push %r14
push %r15
push %r9
push %rdx
// Faulty Load
lea addresses_D+0x2345, %r13
nop
nop
nop
nop
nop
sub %r15, %r15
movups (%r13), %xmm3
vpextrq $1, %xmm3, %r14
lea oracles, %r9
and $0xff, %r14
shlq $12, %r14
mov (%r9,%r14,1), %r14
pop %rdx
pop %r9
pop %r15
pop %r14
pop %r13
ret
/*
<gen_faulty_load>
[REF]
{'src': {'same': False, 'congruent': 0, 'NT': True, 'type': 'addresses_D', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_D', 'size': 16, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 5, 'NT': False, 'type': 'addresses_A_ht', 'size': 16, 'AVXalign': False}}
{'src': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 5, 'same': False}}
{'36': 21829}
36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36
*/
|
ORG 100 /OUT = IN1 MOD IN2
LDA IN2
CMA
INC
STA IN2
LDA IN1
LOOP, ADD IN2
SNA
BUN LOOP
STA IN1
LDA IN2
CMA
INC
STA IN2
LDA IN1
ADD IN2
STA OUTMOD
IN1, DEC 20
IN2, DEC 5
OUTMOD, DEC 0
END
|
0x0000 (0x000000) 0x2118- f:00020 d: 280 | A = OR[280]
0x0001 (0x000002) 0xB434- f:00132 d: 52 | R = OR[52], A = 0
0x0002 (0x000004) 0x0000- f:00000 d: 0 | PASS
0x0003 (0x000006) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0004 (0x000008) 0x291A- f:00024 d: 282 | OR[282] = A
0x0005 (0x00000A) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0006 (0x00000C) 0x291B- f:00024 d: 283 | OR[283] = A
0x0007 (0x00000E) 0x101A- f:00010 d: 26 | A = 26 (0x001A)
0x0008 (0x000010) 0x2926- f:00024 d: 294 | OR[294] = A
0x0009 (0x000012) 0x111B- f:00010 d: 283 | A = 283 (0x011B)
0x000A (0x000014) 0x2927- f:00024 d: 295 | OR[295] = A
0x000B (0x000016) 0x1126- f:00010 d: 294 | A = 294 (0x0126)
0x000C (0x000018) 0x5800- f:00054 d: 0 | B = A
0x000D (0x00001A) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x000E (0x00001C) 0x7C09- f:00076 d: 9 | R = OR[9]
0x000F (0x00001E) 0x8602- f:00103 d: 2 | P = P + 2 (0x0011), A # 0
0x0010 (0x000020) 0x700B- f:00070 d: 11 | P = P + 11 (0x001B)
0x0011 (0x000022) 0x1007- f:00010 d: 7 | A = 7 (0x0007)
0x0012 (0x000024) 0x2926- f:00024 d: 294 | OR[294] = A
0x0013 (0x000026) 0x1001- f:00010 d: 1 | A = 1 (0x0001)
0x0014 (0x000028) 0x2927- f:00024 d: 295 | OR[295] = A
0x0015 (0x00002A) 0x1126- f:00010 d: 294 | A = 294 (0x0126)
0x0016 (0x00002C) 0x5800- f:00054 d: 0 | B = A
0x0017 (0x00002E) 0x1800-0x1D18 f:00014 d: 0 | A = 7448 (0x1D18)
0x0019 (0x000032) 0x7C09- f:00076 d: 9 | R = OR[9]
0x001A (0x000034) 0x7213- f:00071 d: 19 | P = P - 19 (0x0007)
0x001B (0x000036) 0x211B- f:00020 d: 283 | A = OR[283]
0x001C (0x000038) 0x290E- f:00024 d: 270 | OR[270] = A
0x001D (0x00003A) 0x1800-0x0800 f:00014 d: 0 | A = 2048 (0x0800)
0x001F (0x00003E) 0x290D- f:00024 d: 269 | OR[269] = A
0x0020 (0x000040) 0x210D- f:00020 d: 269 | A = OR[269]
0x0021 (0x000042) 0x8406- f:00102 d: 6 | P = P + 6 (0x0027), A = 0
0x0022 (0x000044) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0023 (0x000046) 0x390E- f:00034 d: 270 | (OR[270]) = A
0x0024 (0x000048) 0x2F0D- f:00027 d: 269 | OR[269] = OR[269] - 1
0x0025 (0x00004A) 0x2D0E- f:00026 d: 270 | OR[270] = OR[270] + 1
0x0026 (0x00004C) 0x7206- f:00071 d: 6 | P = P - 6 (0x0020)
0x0027 (0x00004E) 0x1003- f:00010 d: 3 | A = 3 (0x0003)
0x0028 (0x000050) 0x291C- f:00024 d: 284 | OR[284] = A
0x0029 (0x000052) 0x1003- f:00010 d: 3 | A = 3 (0x0003)
0x002A (0x000054) 0x291D- f:00024 d: 285 | OR[285] = A
0x002B (0x000056) 0x750C- f:00072 d: 268 | R = P + 268 (0x0137)
0x002C (0x000058) 0x1003- f:00010 d: 3 | A = 3 (0x0003)
0x002D (0x00005A) 0x291C- f:00024 d: 284 | OR[284] = A
0x002E (0x00005C) 0x1005- f:00010 d: 5 | A = 5 (0x0005)
0x002F (0x00005E) 0x291D- f:00024 d: 285 | OR[285] = A
0x0030 (0x000060) 0x7507- f:00072 d: 263 | R = P + 263 (0x0137)
0x0031 (0x000062) 0x211B- f:00020 d: 283 | A = OR[283]
0x0032 (0x000064) 0x1407- f:00012 d: 7 | A = A + 7 (0x0007)
0x0033 (0x000066) 0x2908- f:00024 d: 264 | OR[264] = A
0x0034 (0x000068) 0x1001- f:00010 d: 1 | A = 1 (0x0001)
0x0035 (0x00006A) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x0036 (0x00006C) 0x211B- f:00020 d: 283 | A = OR[283]
0x0037 (0x00006E) 0x1408- f:00012 d: 8 | A = A + 8 (0x0008)
0x0038 (0x000070) 0x2908- f:00024 d: 264 | OR[264] = A
0x0039 (0x000072) 0x1006- f:00010 d: 6 | A = 6 (0x0006)
0x003A (0x000074) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x003B (0x000076) 0x211B- f:00020 d: 283 | A = OR[283]
0x003C (0x000078) 0x1409- f:00012 d: 9 | A = A + 9 (0x0009)
0x003D (0x00007A) 0x2908- f:00024 d: 264 | OR[264] = A
0x003E (0x00007C) 0x1800-0x4046 f:00014 d: 0 | A = 16454 (0x4046)
0x0040 (0x000080) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x0041 (0x000082) 0x1003- f:00010 d: 3 | A = 3 (0x0003)
0x0042 (0x000084) 0x291C- f:00024 d: 284 | OR[284] = A
0x0043 (0x000086) 0x1004- f:00010 d: 4 | A = 4 (0x0004)
0x0044 (0x000088) 0x291D- f:00024 d: 285 | OR[285] = A
0x0045 (0x00008A) 0x74F2- f:00072 d: 242 | R = P + 242 (0x0137)
0x0046 (0x00008C) 0x1003- f:00010 d: 3 | A = 3 (0x0003)
0x0047 (0x00008E) 0x291E- f:00024 d: 286 | OR[286] = A
0x0048 (0x000090) 0x1006- f:00010 d: 6 | A = 6 (0x0006)
0x0049 (0x000092) 0x291F- f:00024 d: 287 | OR[287] = A
0x004A (0x000094) 0x211F- f:00020 d: 287 | A = OR[287]
0x004B (0x000096) 0x1E00-0x404B f:00017 d: 0 | A = A - 16459 (0x404B)
0x004D (0x00009A) 0x8003- f:00100 d: 3 | P = P + 3 (0x0050), C = 0
0x004E (0x00009C) 0x8402- f:00102 d: 2 | P = P + 2 (0x0050), A = 0
0x004F (0x00009E) 0x7011- f:00070 d: 17 | P = P + 17 (0x0060)
0x0050 (0x0000A0) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0051 (0x0000A2) 0x2920- f:00024 d: 288 | OR[288] = A
0x0052 (0x0000A4) 0x2120- f:00020 d: 288 | A = OR[288]
0x0053 (0x0000A6) 0x1E00-0x0800 f:00017 d: 0 | A = A - 2048 (0x0800)
0x0055 (0x0000AA) 0x8408- f:00102 d: 8 | P = P + 8 (0x005D), A = 0
0x0056 (0x0000AC) 0x211B- f:00020 d: 283 | A = OR[283]
0x0057 (0x0000AE) 0x2520- f:00022 d: 288 | A = A + OR[288]
0x0058 (0x0000B0) 0x2913- f:00024 d: 275 | OR[275] = A
0x0059 (0x0000B2) 0x2113- f:00020 d: 275 | A = OR[275]
0x005A (0x0000B4) 0x3913- f:00034 d: 275 | (OR[275]) = A
0x005B (0x0000B6) 0x2D20- f:00026 d: 288 | OR[288] = OR[288] + 1
0x005C (0x0000B8) 0x720A- f:00071 d: 10 | P = P - 10 (0x0052)
0x005D (0x0000BA) 0x74B8- f:00072 d: 184 | R = P + 184 (0x0115)
0x005E (0x0000BC) 0x2D1F- f:00026 d: 287 | OR[287] = OR[287] + 1
0x005F (0x0000BE) 0x7215- f:00071 d: 21 | P = P - 21 (0x004A)
0x0060 (0x0000C0) 0x1004- f:00010 d: 4 | A = 4 (0x0004)
0x0061 (0x0000C2) 0x291E- f:00024 d: 286 | OR[286] = A
0x0062 (0x0000C4) 0x1006- f:00010 d: 6 | A = 6 (0x0006)
0x0063 (0x0000C6) 0x291F- f:00024 d: 287 | OR[287] = A
0x0064 (0x0000C8) 0x211F- f:00020 d: 287 | A = OR[287]
0x0065 (0x0000CA) 0x1E00-0x404B f:00017 d: 0 | A = A - 16459 (0x404B)
0x0067 (0x0000CE) 0x8003- f:00100 d: 3 | P = P + 3 (0x006A), C = 0
0x0068 (0x0000D0) 0x8402- f:00102 d: 2 | P = P + 2 (0x006A), A = 0
0x0069 (0x0000D2) 0x702D- f:00070 d: 45 | P = P + 45 (0x0096)
0x006A (0x0000D4) 0x211B- f:00020 d: 283 | A = OR[283]
0x006B (0x0000D6) 0x290E- f:00024 d: 270 | OR[270] = A
0x006C (0x0000D8) 0x1800-0x0800 f:00014 d: 0 | A = 2048 (0x0800)
0x006E (0x0000DC) 0x290D- f:00024 d: 269 | OR[269] = A
0x006F (0x0000DE) 0x210D- f:00020 d: 269 | A = OR[269]
0x0070 (0x0000E0) 0x8406- f:00102 d: 6 | P = P + 6 (0x0076), A = 0
0x0071 (0x0000E2) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0072 (0x0000E4) 0x390E- f:00034 d: 270 | (OR[270]) = A
0x0073 (0x0000E6) 0x2F0D- f:00027 d: 269 | OR[269] = OR[269] - 1
0x0074 (0x0000E8) 0x2D0E- f:00026 d: 270 | OR[270] = OR[270] + 1
0x0075 (0x0000EA) 0x7206- f:00071 d: 6 | P = P - 6 (0x006F)
0x0076 (0x0000EC) 0x749F- f:00072 d: 159 | R = P + 159 (0x0115)
0x0077 (0x0000EE) 0x211A- f:00020 d: 282 | A = OR[282]
0x0078 (0x0000F0) 0x8402- f:00102 d: 2 | P = P + 2 (0x007A), A = 0
0x0079 (0x0000F2) 0x701B- f:00070 d: 27 | P = P + 27 (0x0094)
0x007A (0x0000F4) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x007B (0x0000F6) 0x2920- f:00024 d: 288 | OR[288] = A
0x007C (0x0000F8) 0x2120- f:00020 d: 288 | A = OR[288]
0x007D (0x0000FA) 0x1E00-0x0800 f:00017 d: 0 | A = A - 2048 (0x0800)
0x007F (0x0000FE) 0x8415- f:00102 d: 21 | P = P + 21 (0x0094), A = 0
0x0080 (0x000100) 0x211B- f:00020 d: 283 | A = OR[283]
0x0081 (0x000102) 0x2520- f:00022 d: 288 | A = A + OR[288]
0x0082 (0x000104) 0x2913- f:00024 d: 275 | OR[275] = A
0x0083 (0x000106) 0x3113- f:00030 d: 275 | A = (OR[275])
0x0084 (0x000108) 0x2913- f:00024 d: 275 | OR[275] = A
0x0085 (0x00010A) 0x211B- f:00020 d: 283 | A = OR[283]
0x0086 (0x00010C) 0x2520- f:00022 d: 288 | A = A + OR[288]
0x0087 (0x00010E) 0x2908- f:00024 d: 264 | OR[264] = A
0x0088 (0x000110) 0x2113- f:00020 d: 275 | A = OR[275]
0x0089 (0x000112) 0x2708- f:00023 d: 264 | A = A - OR[264]
0x008A (0x000114) 0x8602- f:00103 d: 2 | P = P + 2 (0x008C), A # 0
0x008B (0x000116) 0x7007- f:00070 d: 7 | P = P + 7 (0x0092)
0x008C (0x000118) 0x7511- f:00072 d: 273 | R = P + 273 (0x019D)
0x008D (0x00011A) 0x74C4- f:00072 d: 196 | R = P + 196 (0x0151)
0x008E (0x00011C) 0x1800-0x0800 f:00014 d: 0 | A = 2048 (0x0800)
0x0090 (0x000120) 0x2920- f:00024 d: 288 | OR[288] = A
0x0091 (0x000122) 0x7002- f:00070 d: 2 | P = P + 2 (0x0093)
0x0092 (0x000124) 0x2D20- f:00026 d: 288 | OR[288] = OR[288] + 1
0x0093 (0x000126) 0x7217- f:00071 d: 23 | P = P - 23 (0x007C)
0x0094 (0x000128) 0x2D1F- f:00026 d: 287 | OR[287] = OR[287] + 1
0x0095 (0x00012A) 0x7231- f:00071 d: 49 | P = P - 49 (0x0064)
0x0096 (0x00012C) 0x1004- f:00010 d: 4 | A = 4 (0x0004)
0x0097 (0x00012E) 0x291C- f:00024 d: 284 | OR[284] = A
0x0098 (0x000130) 0x1003- f:00010 d: 3 | A = 3 (0x0003)
0x0099 (0x000132) 0x291D- f:00024 d: 285 | OR[285] = A
0x009A (0x000134) 0x749D- f:00072 d: 157 | R = P + 157 (0x0137)
0x009B (0x000136) 0x1800-0xFFFF f:00014 d: 0 | A = 65535 (0xFFFF)
0x009D (0x00013A) 0x391B- f:00034 d: 283 | (OR[283]) = A
0x009E (0x00013C) 0x211B- f:00020 d: 283 | A = OR[283]
0x009F (0x00013E) 0x1401- f:00012 d: 1 | A = A + 1 (0x0001)
0x00A0 (0x000140) 0x2913- f:00024 d: 275 | OR[275] = A
0x00A1 (0x000142) 0x2119- f:00020 d: 281 | A = OR[281]
0x00A2 (0x000144) 0x290D- f:00024 d: 269 | OR[269] = A
0x00A3 (0x000146) 0x2113- f:00020 d: 275 | A = OR[275]
0x00A4 (0x000148) 0x290E- f:00024 d: 270 | OR[270] = A
0x00A5 (0x00014A) 0x1004- f:00010 d: 4 | A = 4 (0x0004)
0x00A6 (0x00014C) 0x290F- f:00024 d: 271 | OR[271] = A
0x00A7 (0x00014E) 0x7006- f:00070 d: 6 | P = P + 6 (0x00AD)
0x00A8 (0x000150) 0x310D- f:00030 d: 269 | A = (OR[269])
0x00A9 (0x000152) 0x390E- f:00034 d: 270 | (OR[270]) = A
0x00AA (0x000154) 0x2D0D- f:00026 d: 269 | OR[269] = OR[269] + 1
0x00AB (0x000156) 0x2D0E- f:00026 d: 270 | OR[270] = OR[270] + 1
0x00AC (0x000158) 0x2F0F- f:00027 d: 271 | OR[271] = OR[271] - 1
0x00AD (0x00015A) 0x210F- f:00020 d: 271 | A = OR[271]
0x00AE (0x00015C) 0x8E06- f:00107 d: 6 | P = P - 6 (0x00A8), A # 0
0x00AF (0x00015E) 0x1028- f:00010 d: 40 | A = 40 (0x0028)
0x00B0 (0x000160) 0x2926- f:00024 d: 294 | OR[294] = A
0x00B1 (0x000162) 0x1800-0x0041 f:00014 d: 0 | A = 65 (0x0041)
0x00B3 (0x000166) 0x2927- f:00024 d: 295 | OR[295] = A
0x00B4 (0x000168) 0x1800-0x0002 f:00014 d: 0 | A = 2 (0x0002)
0x00B6 (0x00016C) 0x2928- f:00024 d: 296 | OR[296] = A
0x00B7 (0x00016E) 0x211B- f:00020 d: 283 | A = OR[283]
0x00B8 (0x000170) 0x2929- f:00024 d: 297 | OR[297] = A
0x00B9 (0x000172) 0x100A- f:00010 d: 10 | A = 10 (0x000A)
0x00BA (0x000174) 0x292A- f:00024 d: 298 | OR[298] = A
0x00BB (0x000176) 0x1126- f:00010 d: 294 | A = 294 (0x0126)
0x00BC (0x000178) 0x5800- f:00054 d: 0 | B = A
0x00BD (0x00017A) 0x1800-0x1D18 f:00014 d: 0 | A = 7448 (0x1D18)
0x00BF (0x00017E) 0x7C09- f:00076 d: 9 | R = OR[9]
0x00C0 (0x000180) 0x1028- f:00010 d: 40 | A = 40 (0x0028)
0x00C1 (0x000182) 0x2926- f:00024 d: 294 | OR[294] = A
0x00C2 (0x000184) 0x1800-0x0041 f:00014 d: 0 | A = 65 (0x0041)
0x00C4 (0x000188) 0x2927- f:00024 d: 295 | OR[295] = A
0x00C5 (0x00018A) 0x1800-0x0000 f:00014 d: 0 | A = 0 (0x0000)
0x00C7 (0x00018E) 0x2928- f:00024 d: 296 | OR[296] = A
0x00C8 (0x000190) 0x211B- f:00020 d: 283 | A = OR[283]
0x00C9 (0x000192) 0x2929- f:00024 d: 297 | OR[297] = A
0x00CA (0x000194) 0x1012- f:00010 d: 18 | A = 18 (0x0012)
0x00CB (0x000196) 0x292A- f:00024 d: 298 | OR[298] = A
0x00CC (0x000198) 0x1126- f:00010 d: 294 | A = 294 (0x0126)
0x00CD (0x00019A) 0x5800- f:00054 d: 0 | B = A
0x00CE (0x00019C) 0x1800-0x1D18 f:00014 d: 0 | A = 7448 (0x1D18)
0x00D0 (0x0001A0) 0x7C09- f:00076 d: 9 | R = OR[9]
0x00D1 (0x0001A2) 0x211B- f:00020 d: 283 | A = OR[283]
0x00D2 (0x0001A4) 0x1405- f:00012 d: 5 | A = A + 5 (0x0005)
0x00D3 (0x0001A6) 0x2913- f:00024 d: 275 | OR[275] = A
0x00D4 (0x0001A8) 0x211B- f:00020 d: 283 | A = OR[283]
0x00D5 (0x0001AA) 0x140D- f:00012 d: 13 | A = A + 13 (0x000D)
0x00D6 (0x0001AC) 0x2914- f:00024 d: 276 | OR[276] = A
0x00D7 (0x0001AE) 0x2113- f:00020 d: 275 | A = OR[275]
0x00D8 (0x0001B0) 0x290D- f:00024 d: 269 | OR[269] = A
0x00D9 (0x0001B2) 0x2114- f:00020 d: 276 | A = OR[276]
0x00DA (0x0001B4) 0x290E- f:00024 d: 270 | OR[270] = A
0x00DB (0x0001B6) 0x1004- f:00010 d: 4 | A = 4 (0x0004)
0x00DC (0x0001B8) 0x1404- f:00012 d: 4 | A = A + 4 (0x0004)
0x00DD (0x0001BA) 0x290F- f:00024 d: 271 | OR[271] = A
0x00DE (0x0001BC) 0x7006- f:00070 d: 6 | P = P + 6 (0x00E4)
0x00DF (0x0001BE) 0x310D- f:00030 d: 269 | A = (OR[269])
0x00E0 (0x0001C0) 0x390E- f:00034 d: 270 | (OR[270]) = A
0x00E1 (0x0001C2) 0x2D0D- f:00026 d: 269 | OR[269] = OR[269] + 1
0x00E2 (0x0001C4) 0x2D0E- f:00026 d: 270 | OR[270] = OR[270] + 1
0x00E3 (0x0001C6) 0x2F0F- f:00027 d: 271 | OR[271] = OR[271] - 1
0x00E4 (0x0001C8) 0x210F- f:00020 d: 271 | A = OR[271]
0x00E5 (0x0001CA) 0x8E06- f:00107 d: 6 | P = P - 6 (0x00DF), A # 0
0x00E6 (0x0001CC) 0x211B- f:00020 d: 283 | A = OR[283]
0x00E7 (0x0001CE) 0x1415- f:00012 d: 21 | A = A + 21 (0x0015)
0x00E8 (0x0001D0) 0x2908- f:00024 d: 264 | OR[264] = A
0x00E9 (0x0001D2) 0x1004- f:00010 d: 4 | A = 4 (0x0004)
0x00EA (0x0001D4) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x00EB (0x0001D6) 0x211B- f:00020 d: 283 | A = OR[283]
0x00EC (0x0001D8) 0x1416- f:00012 d: 22 | A = A + 22 (0x0016)
0x00ED (0x0001DA) 0x2908- f:00024 d: 264 | OR[264] = A
0x00EE (0x0001DC) 0x1004- f:00010 d: 4 | A = 4 (0x0004)
0x00EF (0x0001DE) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x00F0 (0x0001E0) 0x211B- f:00020 d: 283 | A = OR[283]
0x00F1 (0x0001E2) 0x1417- f:00012 d: 23 | A = A + 23 (0x0017)
0x00F2 (0x0001E4) 0x2908- f:00024 d: 264 | OR[264] = A
0x00F3 (0x0001E6) 0x1005- f:00010 d: 5 | A = 5 (0x0005)
0x00F4 (0x0001E8) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x00F5 (0x0001EA) 0x211B- f:00020 d: 283 | A = OR[283]
0x00F6 (0x0001EC) 0x1418- f:00012 d: 24 | A = A + 24 (0x0018)
0x00F7 (0x0001EE) 0x2908- f:00024 d: 264 | OR[264] = A
0x00F8 (0x0001F0) 0x1005- f:00010 d: 5 | A = 5 (0x0005)
0x00F9 (0x0001F2) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x00FA (0x0001F4) 0x1003- f:00010 d: 3 | A = 3 (0x0003)
0x00FB (0x0001F6) 0x291C- f:00024 d: 284 | OR[284] = A
0x00FC (0x0001F8) 0x1003- f:00010 d: 3 | A = 3 (0x0003)
0x00FD (0x0001FA) 0x291D- f:00024 d: 285 | OR[285] = A
0x00FE (0x0001FC) 0x7439- f:00072 d: 57 | R = P + 57 (0x0137)
0x00FF (0x0001FE) 0x211B- f:00020 d: 283 | A = OR[283]
0x0100 (0x000200) 0x8602- f:00103 d: 2 | P = P + 2 (0x0102), A # 0
0x0101 (0x000202) 0x7009- f:00070 d: 9 | P = P + 9 (0x010A)
0x0102 (0x000204) 0x101B- f:00010 d: 27 | A = 27 (0x001B)
0x0103 (0x000206) 0x2926- f:00024 d: 294 | OR[294] = A
0x0104 (0x000208) 0x211B- f:00020 d: 283 | A = OR[283]
0x0105 (0x00020A) 0x2927- f:00024 d: 295 | OR[295] = A
0x0106 (0x00020C) 0x1126- f:00010 d: 294 | A = 294 (0x0126)
0x0107 (0x00020E) 0x5800- f:00054 d: 0 | B = A
0x0108 (0x000210) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0109 (0x000212) 0x7C09- f:00076 d: 9 | R = OR[9]
0x010A (0x000214) 0x2005- f:00020 d: 5 | A = OR[5]
0x010B (0x000216) 0x1406- f:00012 d: 6 | A = A + 6 (0x0006)
0x010C (0x000218) 0x2908- f:00024 d: 264 | OR[264] = A
0x010D (0x00021A) 0x211A- f:00020 d: 282 | A = OR[282]
0x010E (0x00021C) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x010F (0x00021E) 0x102A- f:00010 d: 42 | A = 42 (0x002A)
0x0110 (0x000220) 0x2926- f:00024 d: 294 | OR[294] = A
0x0111 (0x000222) 0x1126- f:00010 d: 294 | A = 294 (0x0126)
0x0112 (0x000224) 0x5800- f:00054 d: 0 | B = A
0x0113 (0x000226) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0114 (0x000228) 0x7C09- f:00076 d: 9 | R = OR[9]
0x0115 (0x00022A) 0x1028- f:00010 d: 40 | A = 40 (0x0028)
0x0116 (0x00022C) 0x2926- f:00024 d: 294 | OR[294] = A
0x0117 (0x00022E) 0x1800-0x00A6 f:00014 d: 0 | A = 166 (0x00A6)
0x0119 (0x000232) 0x2927- f:00024 d: 295 | OR[295] = A
0x011A (0x000234) 0x2118- f:00020 d: 280 | A = OR[280]
0x011B (0x000236) 0x2928- f:00024 d: 296 | OR[296] = A
0x011C (0x000238) 0x211E- f:00020 d: 286 | A = OR[286]
0x011D (0x00023A) 0x2929- f:00024 d: 297 | OR[297] = A
0x011E (0x00023C) 0x211B- f:00020 d: 283 | A = OR[283]
0x011F (0x00023E) 0x292A- f:00024 d: 298 | OR[298] = A
0x0120 (0x000240) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0121 (0x000242) 0x292B- f:00024 d: 299 | OR[299] = A
0x0122 (0x000244) 0x211F- f:00020 d: 287 | A = OR[287]
0x0123 (0x000246) 0x292C- f:00024 d: 300 | OR[300] = A
0x0124 (0x000248) 0x1126- f:00010 d: 294 | A = 294 (0x0126)
0x0125 (0x00024A) 0x5800- f:00054 d: 0 | B = A
0x0126 (0x00024C) 0x1800-0x1D18 f:00014 d: 0 | A = 7448 (0x1D18)
0x0128 (0x000250) 0x7C09- f:00076 d: 9 | R = OR[9]
0x0129 (0x000252) 0x291A- f:00024 d: 282 | OR[282] = A
0x012A (0x000254) 0x211A- f:00020 d: 282 | A = OR[282]
0x012B (0x000256) 0x8602- f:00103 d: 2 | P = P + 2 (0x012D), A # 0
0x012C (0x000258) 0x700A- f:00070 d: 10 | P = P + 10 (0x0136)
0x012D (0x00025A) 0x211A- f:00020 d: 282 | A = OR[282]
0x012E (0x00025C) 0x1609- f:00013 d: 9 | A = A - 9 (0x0009)
0x012F (0x00025E) 0x8402- f:00102 d: 2 | P = P + 2 (0x0131), A = 0
0x0130 (0x000260) 0x7005- f:00070 d: 5 | P = P + 5 (0x0135)
0x0131 (0x000262) 0x7420- f:00072 d: 32 | R = P + 32 (0x0151)
0x0132 (0x000264) 0x1009- f:00010 d: 9 | A = 9 (0x0009)
0x0133 (0x000266) 0x291A- f:00024 d: 282 | OR[282] = A
0x0134 (0x000268) 0x7002- f:00070 d: 2 | P = P + 2 (0x0136)
0x0135 (0x00026A) 0x7236- f:00071 d: 54 | P = P - 54 (0x00FF)
0x0136 (0x00026C) 0x0200- f:00001 d: 0 | EXIT
0x0137 (0x00026E) 0x1028- f:00010 d: 40 | A = 40 (0x0028)
0x0138 (0x000270) 0x2926- f:00024 d: 294 | OR[294] = A
0x0139 (0x000272) 0x1800-0x00A6 f:00014 d: 0 | A = 166 (0x00A6)
0x013B (0x000276) 0x2927- f:00024 d: 295 | OR[295] = A
0x013C (0x000278) 0x2118- f:00020 d: 280 | A = OR[280]
0x013D (0x00027A) 0x2928- f:00024 d: 296 | OR[296] = A
0x013E (0x00027C) 0x211C- f:00020 d: 284 | A = OR[284]
0x013F (0x00027E) 0x2929- f:00024 d: 297 | OR[297] = A
0x0140 (0x000280) 0x211B- f:00020 d: 283 | A = OR[283]
0x0141 (0x000282) 0x292A- f:00024 d: 298 | OR[298] = A
0x0142 (0x000284) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0143 (0x000286) 0x292B- f:00024 d: 299 | OR[299] = A
0x0144 (0x000288) 0x211D- f:00020 d: 285 | A = OR[285]
0x0145 (0x00028A) 0x292C- f:00024 d: 300 | OR[300] = A
0x0146 (0x00028C) 0x1126- f:00010 d: 294 | A = 294 (0x0126)
0x0147 (0x00028E) 0x5800- f:00054 d: 0 | B = A
0x0148 (0x000290) 0x1800-0x1D18 f:00014 d: 0 | A = 7448 (0x1D18)
0x014A (0x000294) 0x7C09- f:00076 d: 9 | R = OR[9]
0x014B (0x000296) 0x291A- f:00024 d: 282 | OR[282] = A
0x014C (0x000298) 0x211A- f:00020 d: 282 | A = OR[282]
0x014D (0x00029A) 0x8602- f:00103 d: 2 | P = P + 2 (0x014F), A # 0
0x014E (0x00029C) 0x7002- f:00070 d: 2 | P = P + 2 (0x0150)
0x014F (0x00029E) 0x7250- f:00071 d: 80 | P = P - 80 (0x00FF)
0x0150 (0x0002A0) 0x0200- f:00001 d: 0 | EXIT
0x0151 (0x0002A2) 0x1004- f:00010 d: 4 | A = 4 (0x0004)
0x0152 (0x0002A4) 0x291C- f:00024 d: 284 | OR[284] = A
0x0153 (0x0002A6) 0x1003- f:00010 d: 3 | A = 3 (0x0003)
0x0154 (0x0002A8) 0x291D- f:00024 d: 285 | OR[285] = A
0x0155 (0x0002AA) 0x761E- f:00073 d: 30 | R = P - 30 (0x0137)
0x0156 (0x0002AC) 0x211B- f:00020 d: 283 | A = OR[283]
0x0157 (0x0002AE) 0x1C00-0x03FA f:00016 d: 0 | A = A + 1018 (0x03FA)
0x0159 (0x0002B2) 0x2913- f:00024 d: 275 | OR[275] = A
0x015A (0x0002B4) 0x100F- f:00010 d: 15 | A = 15 (0x000F)
0x015B (0x0002B6) 0x271F- f:00023 d: 287 | A = A - OR[287]
0x015C (0x0002B8) 0x120F- f:00011 d: 15 | A = A & 15 (0x000F)
0x015D (0x0002BA) 0x5800- f:00054 d: 0 | B = A
0x015E (0x0002BC) 0x211F- f:00020 d: 287 | A = OR[287]
0x015F (0x0002BE) 0x0804- f:00004 d: 4 | A = A > 4 (0x0004)
0x0160 (0x0002C0) 0x2513- f:00022 d: 275 | A = A + OR[275]
0x0161 (0x0002C2) 0x290D- f:00024 d: 269 | OR[269] = A
0x0162 (0x0002C4) 0x310D- f:00030 d: 269 | A = (OR[269])
0x0163 (0x0002C6) 0x4800- f:00044 d: 0 | A = A > B
0x0164 (0x0002C8) 0x1201- f:00011 d: 1 | A = A & 1 (0x0001)
0x0165 (0x0002CA) 0x2914- f:00024 d: 276 | OR[276] = A
0x0166 (0x0002CC) 0x2114- f:00020 d: 276 | A = OR[276]
0x0167 (0x0002CE) 0x8402- f:00102 d: 2 | P = P + 2 (0x0169), A = 0
0x0168 (0x0002D0) 0x7034- f:00070 d: 52 | P = P + 52 (0x019C)
0x0169 (0x0002D2) 0x100F- f:00010 d: 15 | A = 15 (0x000F)
0x016A (0x0002D4) 0x271F- f:00023 d: 287 | A = A - OR[287]
0x016B (0x0002D6) 0x120F- f:00011 d: 15 | A = A & 15 (0x000F)
0x016C (0x0002D8) 0x5800- f:00054 d: 0 | B = A
0x016D (0x0002DA) 0x1001- f:00010 d: 1 | A = 1 (0x0001)
0x016E (0x0002DC) 0x1201- f:00011 d: 1 | A = A & 1 (0x0001)
0x016F (0x0002DE) 0x290D- f:00024 d: 269 | OR[269] = A
0x0170 (0x0002E0) 0x211F- f:00020 d: 287 | A = OR[287]
0x0171 (0x0002E2) 0x0804- f:00004 d: 4 | A = A > 4 (0x0004)
0x0172 (0x0002E4) 0x2513- f:00022 d: 275 | A = A + OR[275]
0x0173 (0x0002E6) 0x290E- f:00024 d: 270 | OR[270] = A
0x0174 (0x0002E8) 0x310E- f:00030 d: 270 | A = (OR[270])
0x0175 (0x0002EA) 0x4C00- f:00046 d: 0 | A = A >> B
0x0176 (0x0002EC) 0x0801- f:00004 d: 1 | A = A > 1 (0x0001)
0x0177 (0x0002EE) 0x0A01- f:00005 d: 1 | A = A < 1 (0x0001)
0x0178 (0x0002F0) 0x250D- f:00022 d: 269 | A = A + OR[269]
0x0179 (0x0002F2) 0x4E00- f:00047 d: 0 | A = A << B
0x017A (0x0002F4) 0x390E- f:00034 d: 270 | (OR[270]) = A
0x017B (0x0002F6) 0x211B- f:00020 d: 283 | A = OR[283]
0x017C (0x0002F8) 0x1C00-0x03F9 f:00016 d: 0 | A = A + 1017 (0x03F9)
0x017E (0x0002FC) 0x2908- f:00024 d: 264 | OR[264] = A
0x017F (0x0002FE) 0x3D08- f:00036 d: 264 | (OR[264]) = (OR[264]) + 1
0x0180 (0x000300) 0x1003- f:00010 d: 3 | A = 3 (0x0003)
0x0181 (0x000302) 0x291C- f:00024 d: 284 | OR[284] = A
0x0182 (0x000304) 0x1003- f:00010 d: 3 | A = 3 (0x0003)
0x0183 (0x000306) 0x291D- f:00024 d: 285 | OR[285] = A
0x0184 (0x000308) 0x764D- f:00073 d: 77 | R = P - 77 (0x0137)
0x0185 (0x00030A) 0x1028- f:00010 d: 40 | A = 40 (0x0028)
0x0186 (0x00030C) 0x2926- f:00024 d: 294 | OR[294] = A
0x0187 (0x00030E) 0x1800-0x00F1 f:00014 d: 0 | A = 241 (0x00F1)
0x0189 (0x000312) 0x2927- f:00024 d: 295 | OR[295] = A
0x018A (0x000314) 0x2118- f:00020 d: 280 | A = OR[280]
0x018B (0x000316) 0x2928- f:00024 d: 296 | OR[296] = A
0x018C (0x000318) 0x211F- f:00020 d: 287 | A = OR[287]
0x018D (0x00031A) 0x2929- f:00024 d: 297 | OR[297] = A
0x018E (0x00031C) 0x1001- f:00010 d: 1 | A = 1 (0x0001)
0x018F (0x00031E) 0x292A- f:00024 d: 298 | OR[298] = A
0x0190 (0x000320) 0x1015- f:00010 d: 21 | A = 21 (0x0015)
0x0191 (0x000322) 0x292B- f:00024 d: 299 | OR[299] = A
0x0192 (0x000324) 0x1126- f:00010 d: 294 | A = 294 (0x0126)
0x0193 (0x000326) 0x5800- f:00054 d: 0 | B = A
0x0194 (0x000328) 0x1800-0x1D18 f:00014 d: 0 | A = 7448 (0x1D18)
0x0196 (0x00032C) 0x7C09- f:00076 d: 9 | R = OR[9]
0x0197 (0x00032E) 0x291A- f:00024 d: 282 | OR[282] = A
0x0198 (0x000330) 0x211A- f:00020 d: 282 | A = OR[282]
0x0199 (0x000332) 0x8602- f:00103 d: 2 | P = P + 2 (0x019B), A # 0
0x019A (0x000334) 0x7002- f:00070 d: 2 | P = P + 2 (0x019C)
0x019B (0x000336) 0x729C- f:00071 d: 156 | P = P - 156 (0x00FF)
0x019C (0x000338) 0x0200- f:00001 d: 0 | EXIT
0x019D (0x00033A) 0x2118- f:00020 d: 280 | A = OR[280]
0x019E (0x00033C) 0x1400- f:00012 d: 0 | A = A + 0 (0x0000)
0x019F (0x00033E) 0x2913- f:00024 d: 275 | OR[275] = A
0x01A0 (0x000340) 0x2003- f:00020 d: 3 | A = OR[3]
0x01A1 (0x000342) 0x1C00-0x0204 f:00016 d: 0 | A = A + 516 (0x0204)
0x01A3 (0x000346) 0x2914- f:00024 d: 276 | OR[276] = A
0x01A4 (0x000348) 0x2003- f:00020 d: 3 | A = OR[3]
0x01A5 (0x00034A) 0x1C00-0x0209 f:00016 d: 0 | A = A + 521 (0x0209)
0x01A7 (0x00034E) 0x2915- f:00024 d: 277 | OR[277] = A
0x01A8 (0x000350) 0x1028- f:00010 d: 40 | A = 40 (0x0028)
0x01A9 (0x000352) 0x2926- f:00024 d: 294 | OR[294] = A
0x01AA (0x000354) 0x1800-0x002F f:00014 d: 0 | A = 47 (0x002F)
0x01AC (0x000358) 0x2927- f:00024 d: 295 | OR[295] = A
0x01AD (0x00035A) 0x1800-0x02CF f:00014 d: 0 | A = 719 (0x02CF)
0x01AF (0x00035E) 0x2928- f:00024 d: 296 | OR[296] = A
0x01B0 (0x000360) 0x2113- f:00020 d: 275 | A = OR[275]
0x01B1 (0x000362) 0x2929- f:00024 d: 297 | OR[297] = A
0x01B2 (0x000364) 0x2114- f:00020 d: 276 | A = OR[276]
0x01B3 (0x000366) 0x292A- f:00024 d: 298 | OR[298] = A
0x01B4 (0x000368) 0x2115- f:00020 d: 277 | A = OR[277]
0x01B5 (0x00036A) 0x292B- f:00024 d: 299 | OR[299] = A
0x01B6 (0x00036C) 0x1126- f:00010 d: 294 | A = 294 (0x0126)
0x01B7 (0x00036E) 0x5800- f:00054 d: 0 | B = A
0x01B8 (0x000370) 0x1800-0x1D18 f:00014 d: 0 | A = 7448 (0x1D18)
0x01BA (0x000374) 0x7C09- f:00076 d: 9 | R = OR[9]
0x01BB (0x000376) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x01BC (0x000378) 0x2923- f:00024 d: 291 | OR[291] = A
0x01BD (0x00037A) 0x211F- f:00020 d: 287 | A = OR[287]
0x01BE (0x00037C) 0x2913- f:00024 d: 275 | OR[275] = A
0x01BF (0x00037E) 0x2118- f:00020 d: 280 | A = OR[280]
0x01C0 (0x000380) 0x1406- f:00012 d: 6 | A = A + 6 (0x0006)
0x01C1 (0x000382) 0x2908- f:00024 d: 264 | OR[264] = A
0x01C2 (0x000384) 0x3108- f:00030 d: 264 | A = (OR[264])
0x01C3 (0x000386) 0x2914- f:00024 d: 276 | OR[276] = A
0x01C4 (0x000388) 0x2113- f:00020 d: 275 | A = OR[275]
0x01C5 (0x00038A) 0x2714- f:00023 d: 276 | A = A - OR[276]
0x01C6 (0x00038C) 0x8006- f:00100 d: 6 | P = P + 6 (0x01CC), C = 0
0x01C7 (0x00038E) 0x2113- f:00020 d: 275 | A = OR[275]
0x01C8 (0x000390) 0x2714- f:00023 d: 276 | A = A - OR[276]
0x01C9 (0x000392) 0x2913- f:00024 d: 275 | OR[275] = A
0x01CA (0x000394) 0x2D23- f:00026 d: 291 | OR[291] = OR[291] + 1
0x01CB (0x000396) 0x7207- f:00071 d: 7 | P = P - 7 (0x01C4)
0x01CC (0x000398) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x01CD (0x00039A) 0x2925- f:00024 d: 293 | OR[293] = A
0x01CE (0x00039C) 0x2118- f:00020 d: 280 | A = OR[280]
0x01CF (0x00039E) 0x1407- f:00012 d: 7 | A = A + 7 (0x0007)
0x01D0 (0x0003A0) 0x2908- f:00024 d: 264 | OR[264] = A
0x01D1 (0x0003A2) 0x3108- f:00030 d: 264 | A = (OR[264])
0x01D2 (0x0003A4) 0x2924- f:00024 d: 292 | OR[292] = A
0x01D3 (0x0003A6) 0x2113- f:00020 d: 275 | A = OR[275]
0x01D4 (0x0003A8) 0x8406- f:00102 d: 6 | P = P + 6 (0x01DA), A = 0
0x01D5 (0x0003AA) 0x2F13- f:00027 d: 275 | OR[275] = OR[275] - 1
0x01D6 (0x0003AC) 0x2125- f:00020 d: 293 | A = OR[293]
0x01D7 (0x0003AE) 0x2524- f:00022 d: 292 | A = A + OR[292]
0x01D8 (0x0003B0) 0x2925- f:00024 d: 293 | OR[293] = A
0x01D9 (0x0003B2) 0x7206- f:00071 d: 6 | P = P - 6 (0x01D3)
0x01DA (0x0003B4) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x01DB (0x0003B6) 0x2922- f:00024 d: 290 | OR[290] = A
0x01DC (0x0003B8) 0x2118- f:00020 d: 280 | A = OR[280]
0x01DD (0x0003BA) 0x1405- f:00012 d: 5 | A = A + 5 (0x0005)
0x01DE (0x0003BC) 0x2908- f:00024 d: 264 | OR[264] = A
0x01DF (0x0003BE) 0x3108- f:00030 d: 264 | A = (OR[264])
0x01E0 (0x0003C0) 0x2914- f:00024 d: 276 | OR[276] = A
0x01E1 (0x0003C2) 0x2123- f:00020 d: 291 | A = OR[291]
0x01E2 (0x0003C4) 0x2714- f:00023 d: 276 | A = A - OR[276]
0x01E3 (0x0003C6) 0x8006- f:00100 d: 6 | P = P + 6 (0x01E9), C = 0
0x01E4 (0x0003C8) 0x2123- f:00020 d: 291 | A = OR[291]
0x01E5 (0x0003CA) 0x2714- f:00023 d: 276 | A = A - OR[276]
0x01E6 (0x0003CC) 0x2923- f:00024 d: 291 | OR[291] = A
0x01E7 (0x0003CE) 0x2D22- f:00026 d: 290 | OR[290] = OR[290] + 1
0x01E8 (0x0003D0) 0x7207- f:00071 d: 7 | P = P - 7 (0x01E1)
0x01E9 (0x0003D2) 0x1028- f:00010 d: 40 | A = 40 (0x0028)
0x01EA (0x0003D4) 0x2926- f:00024 d: 294 | OR[294] = A
0x01EB (0x0003D6) 0x1800-0x002F f:00014 d: 0 | A = 47 (0x002F)
0x01ED (0x0003DA) 0x2927- f:00024 d: 295 | OR[295] = A
0x01EE (0x0003DC) 0x1800-0x02C3 f:00014 d: 0 | A = 707 (0x02C3)
0x01F0 (0x0003E0) 0x2928- f:00024 d: 296 | OR[296] = A
0x01F1 (0x0003E2) 0x2122- f:00020 d: 290 | A = OR[290]
0x01F2 (0x0003E4) 0x2929- f:00024 d: 297 | OR[297] = A
0x01F3 (0x0003E6) 0x2123- f:00020 d: 291 | A = OR[291]
0x01F4 (0x0003E8) 0x292A- f:00024 d: 298 | OR[298] = A
0x01F5 (0x0003EA) 0x2125- f:00020 d: 293 | A = OR[293]
0x01F6 (0x0003EC) 0x292B- f:00024 d: 299 | OR[299] = A
0x01F7 (0x0003EE) 0x1126- f:00010 d: 294 | A = 294 (0x0126)
0x01F8 (0x0003F0) 0x5800- f:00054 d: 0 | B = A
0x01F9 (0x0003F2) 0x1800-0x1D18 f:00014 d: 0 | A = 7448 (0x1D18)
0x01FB (0x0003F6) 0x7C09- f:00076 d: 9 | R = OR[9]
0x01FC (0x0003F8) 0x0200- f:00001 d: 0 | EXIT
0x01FD (0x0003FA) 0x0000- f:00000 d: 0 | PASS
0x01FE (0x0003FC) 0x434F- f:00041 d: 335 | C = 1, io 0517 = BZ
0x01FF (0x0003FE) 0x4D50- f:00046 d: 336 | A = A >> B | **** non-standard encoding with D:0x0150 ****
0x0200 (0x000400) 0x4152- f:00040 d: 338 | C = 1, io 0522 = DN
0x0201 (0x000402) 0x4500- f:00042 d: 256 | C = 1, IOB = DN | **** non-standard encoding with D:0x0100 ****
0x0202 (0x000404) 0x0000- f:00000 d: 0 | PASS
0x0203 (0x000406) 0x554E- f:00052 d: 334 | A = A + B | **** non-standard encoding with D:0x014E ****
0x0204 (0x000408) 0x0000- f:00000 d: 0 | PASS
0x0205 (0x00040A) 0x0000- f:00000 d: 0 | PASS
0x0206 (0x00040C) 0x0000- f:00000 d: 0 | PASS
0x0207 (0x00040E) 0x0000- f:00000 d: 0 | PASS
|
; double __FASTCALL__ atanh(double x)
SECTION code_clib
SECTION code_fp_math48
PUBLIC cm48_sccz80_atanh
EXTERN am48_atanh
defc cm48_sccz80_atanh = am48_atanh
|
;;; Redistribution and use in source and binary forms, with or without modification, are permitted
;;; provided that the following conditions are met:
;;; 1. Redistributions of source code must retain the above copyright notice, this list of
;;; conditions and the following disclaimer.
;;; 2. Redistributions in binary form must reproduce the above copyright notice, this list of
;;; conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR "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 AUTHOR 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.
; $Header: /nfs/sc/proj/ctg/psl002/CVS/pillar_pthread/src/base/prtstubs.nasm,v 1.8 2012/03/16 21:15:42 taanders Exp $
%ifndef __x86_64__
SECTION .data
junk1: dd 0
junk2: dd 0
SECTION .text
; =============================================================================
; Declare external functions as near ones for calls below.
extern prt_ExitThread
extern printf
extern exit
extern prtYieldUnmanaged
extern prtFatCutTo
extern prt_PrintIllegalCutMessage
extern prt_ValidateVsh
extern pcallOnSystemStack
extern prt_needsToYield
extern prt_validateTlsPointer
extern prtYieldUntil
extern prtToUnmanaged
extern prtToManaged
extern prt_GetTaskNonInline
extern registerBootstrapTaskCim
extern prtPillarCompilerUnwinder
%define REGISTER_SIZE 4
common prt_Globals 4
common prtMinFreeStackSpace 4
%else ; // __x86_64__
SECTION .data
;junk1: dq 0
;junk2: dq 0
SECTION .text
; =============================================================================
; Declare external functions as near ones for calls below.
extern prt_ExitThread
extern printf
extern exit
extern prtYieldUnmanaged
extern prtFatCutTo
extern prt_PrintIllegalCutMessage
extern prt_ValidateVsh
extern pcallOnSystemStack
extern prt_needsToYield
extern prt_validateTlsPointer
extern prtYieldUntil
extern prtToUnmanaged
extern prtToManaged
extern prt_GetTaskNonInline
extern registerBootstrapTaskCim
extern prtPillarCompilerUnwinder
%define REGISTER_SIZE 8
common prt_Globals 8
common prtMinFreeStackSpace 4
%endif ; // __x86_64__
%define MIN_UNMANAGED_STACK 500000
; ==============================================================================
; These constants are verified in the validateStubConstants function
%ifdef TLS0
%define PRT_TASK_USER_TLS 0 ; mUserTls
%define PRT_TASK_LAST_VSE REGISTER_SIZE ; mLastVse
%else
%define PRT_TASK_USER_TLS REGISTER_SIZE ; mUserTls
%define PRT_TASK_LAST_VSE 0 ; mLastVse
%endif
%define PRT_TASK_THREAD_HANDLE 2*REGISTER_SIZE ; mThreadHandle
%define PRT_VSE_ENTRY_TYPE_CODE 0 ; entryTypeCode
%define PRT_VSE_NEXT_FRAME REGISTER_SIZE ; nextFrame
%define PRT_VSE_TARGET_CONTINUATION 2*REGISTER_SIZE ; targetContinuation
%define CONTINUATION_EIP_OFFSET 0
%ifndef __x86_64__
; ==============================================================================
; COMMON CODE SEQUENCES
; ==============================================================================
;TLS_REGISTER = "ebx"
; Check for a valid TLS_REGISTER setting.
%ifdef TLS_REGISTER
%if TLS_REGISTER == "ebx"
;ECHO Using ebx as TLS register.
%define tlsreg ebx
%define savereg1 esi
%define savereg2 edi
%macro restoreTlsRegister 0
mov tlsreg, [ ebp + _savedEbx$ ]
%endmacro
%elif TLS_REGISTER == "edi"
;ECHO Using edi as TLS register.
%define tlsreg edi
%define savereg1 esi
%define savereg2 ebx
%macro restoreTlsRegister 0
mov tlsreg, [ ebp + savedEdi$ ]
%endmacro
%else
;ECHO Error: TLS_REGISTER should be set to "ebx" or "edi", or left unset.
.ERR
%endif
%else
%define savereg1 esi
%define savereg2 edi
%macro restoreTlsRegister 0
%endmacro
%endif
; // Like getTlsIntoEax below but always refreshes tlsreg from the current thread's TLS.
%macro loadTlsRegister 0
call dword prt_GetTaskNonInline
mov tlsreg, eax
%endmacro
; // Returns the current thread's TLS (its PrtTask pointer) in eax. Leaves other registers unchanged.
%macro getTlsIntoEax 0
%ifdef TLS_REGISTER
mov eax, tlsreg
%else
call dword prt_GetTaskNonInline
%endif
%endmacro
; // A stub prologue that sets up an ebp-based frame and saves ebx, esi, edi.
%macro fullStubProlog 0
push ebp
mov ebp, esp
push ebx
push esi
push edi
%endmacro
; // Inverse of fullStubProlog
%macro fullStubEpilog 0
pop edi
pop esi
pop ebx
pop ebp
%endmacro
; // Copies a function's arguments to its frame. Also reserves space in the frame for the copied arguments.
; // Leaves eax and edx untouched.
; // Modifies ebx, ecx, esi, edi.
; // Upon exit, ebx will contain the number of bytes of arguments.
;%macro copyArgs 2 ; argStartOffsetFromEbp, argSizeOffsetFromEbp
%macro copyArgs 2
mov ebx, [ ebp + %2 ]
shl ebx, 2
sub esp, ebx
cld
mov ecx, dword [ ebp + %2 ]
mov esi, dword [ ebp + %1 ]
mov edi, esp
rep movsd
%endmacro
; // Restore the original frame's ebp and esp values using edx, which points to a VSE embedded in the frame.
%macro continuationProlog 2 ; espOffsetFromEbp, contOffsetFromEbp
lea esp, [edx - %2 + %1]
lea ebp, [edx - %2]
%endmacro
; // Pushes a VSE. Assumes Prt_Task pointer is in eax. Leaves eax and edx intact.
%macro pushVse 2 ; VseOffsetFromEbp, VseType
mov ecx, [eax+PRT_TASK_LAST_VSE]
mov dword [ebp+%1+PRT_VSE_ENTRY_TYPE_CODE], %2
mov dword [ebp+%1+PRT_VSE_NEXT_FRAME], ecx
mov dword [ebp+%1+PRT_VSE_TARGET_CONTINUATION], 0
lea ecx, [ebp+%1]
mov [eax+PRT_TASK_LAST_VSE], ecx
%endmacro
; // Pops a VSE. Assumes Prt_Task pointer is in eax. Leaves eax and edx intact.
%macro popVse 2 ; VseOffsetFromEbp, VseType
%ifdef DEBUG_VSE_POPS
push eax
push edx
push %2
lea ecx, [ebp+%1]
push ecx
call dword prt_ValidateVsh
add esp, 8
pop edx
pop eax
%endif ; // DEBUG_VSE_POPS
mov ecx, [eax+PRT_TASK_LAST_VSE]
mov ecx, [ecx+PRT_VSE_NEXT_FRAME]
mov [eax+PRT_TASK_LAST_VSE], ecx
%endmacro
; ==============================================================================
global prtWatermarkPrototype
global prt_WatermarkPrototypeStart
global prt_WatermarkPostTopIndex1
global prt_WatermarkPostTopIndex2
global prt_WatermarkPostStubStackStart
global prt_WatermarkPostStubStart
global prt_WatermarkPostRealEipMove
global prt_WatermarkPrototypeEnd
prtWatermarkPrototype:
prt_WatermarkPrototypeStart:
mov ecx, dword [junk1] ; // ecx = current top index
prt_WatermarkPostTopIndex1:
inc ecx ; // ecx = new top index
mov dword [junk1], ecx ; // increment the stack's top
prt_WatermarkPostTopIndex2:
lea ecx, [junk2+ecx*REGISTER_SIZE] ; // ecx = address of the top free stub stack array entry
prt_WatermarkPostStubStackStart:
mov dword [ecx], prt_WatermarkPrototypeStart ; // write the stub start value into the stub stack array
prt_WatermarkPostStubStart:
mov ecx, exit
prt_WatermarkPostRealEipMove:
jmp ecx ; // any jump target will do...will be replaced in each copy of the stub
prt_WatermarkPrototypeEnd:
; ==============================================================================
; // void __pdecl prtYield(void);
global prtYield
global prt_YieldStart
global prt_YieldEnd
prtYield:
prt_YieldStart:
ret
prt_YieldEnd:
; ==============================================================================
; // void __stdcall prtInvokeManagedFunc(PrtCodeAddress managedFunc, void *argStart, unsigned argSize);
; // Export the different locations within the prtInvokeManagedFunc function.
global prtInvokeManagedFunc ; start of the function
global prtInvokeManagedIntRet ; start of the function
global prt_InvokeManagedFuncStart ; start of the function
global prt_InvokeManagedFuncUnwindContinuation
global prt_InvokeManagedFuncEnd ; end of the function
; // Stack offsets of this function's aguments.
%define _managedFunc$ REGISTER_SIZE + REGISTER_SIZE
%define _argStart$ _managedFunc$ + REGISTER_SIZE
%define _argSize$ _argStart$ + REGISTER_SIZE
; // Stack frame layout:
; ebp+0: saved ebp
; ebp-4: saved ebx
; ebp-8: saved esi
; ebp-12: saved edi
%define _savedEbx$ -REGISTER_SIZE
%define _savedEsi$ _savedEbx$ - REGISTER_SIZE
%define _savedEdi$ _savedEsi$ - REGISTER_SIZE
%define _contArgHigh32Bits$ _savedEdi$ - REGISTER_SIZE
%define _firstFrameLocal$ _savedEdi$ - REGISTER_SIZE ; intentionally same
%define _contArgLow32Bits$ _contArgHigh32Bits$ - REGISTER_SIZE
%define _contVsh$ _contArgLow32Bits$ - REGISTER_SIZE
%define _contEip$ _contVsh$ - REGISTER_SIZE
%define _contStart$ _contVsh$ - REGISTER_SIZE
%define _normalEsp$ _contVsh$ - REGISTER_SIZE
%define U2MFRAMESIZE (((_firstFrameLocal$) - (_normalEsp$)) + (REGISTER_SIZE))
prtInvokeManagedIntRet:
prtInvokeManagedFunc:
prt_InvokeManagedFuncStart:
; // A stack limit check is unnecessary because we must already be running
; // on a full-sized stack for unmanaged code.
fullStubProlog ; // basic ebp-based frame prolog that saves ebx, esi, edi
sub esp , U2MFRAMESIZE
copyArgs _argStart$ , _argSize$ ; // reserve space and copy arguments
%ifdef TLS_REGISTER
loadTlsRegister
%endif
call dword [ ebp + _managedFunc$ ] ; // call the managed function. don't disturb the return registers after this
prt_InvokeManagedFuncAfterCall:
add esp, U2MFRAMESIZE
fullStubEpilog
ret 12
prt_InvokeManagedFuncUnwindContinuation:
continuationProlog _normalEsp$, _contStart$
mov eax, dword [ ebp + _contArgLow32Bits$ ]
mov edx, dword [ ebp + _contArgHigh32Bits$ ]
jmp prt_InvokeManagedFuncAfterCall
prt_InvokeManagedFuncEnd:
; ==============================================================================
global prtInvokeUnmanagedFunc ; start of the function
global prtInvokeUnmanagedIntRet ; start of the function
global prt_InvokeUnmanagedFuncStart ; start of the function
global prt_InvokeUnmanagedFuncPostCall ;
global prt_InvokeUnmanagedFuncDestructor ; VSE type identifier (code address)
global prt_InvokeUnmanagedFuncUnwindContinuation
global prt_InvokeUnmanagedFuncEnd ; end of the function
; // Stack offsets of this function's aguments.
%define _unmanagedFunc$ REGISTER_SIZE + REGISTER_SIZE
%define _argStart$ _unmanagedFunc$ + REGISTER_SIZE
%define _argSize$ _argStart$ + REGISTER_SIZE
%define _callingConvention$ _argSize$ + REGISTER_SIZE
; // Keep these offsets up to date with the definition of struct Prt_M2uFrame.
; Stack frame layout:
; ebp+0: saved ebp
; ebp-4: saved ebx
; ebp-8: saved esi
; ebp-12: saved edi
%define _savedEbx$ -REGISTER_SIZE
%define _savedEsi$ _savedEbx$ - REGISTER_SIZE
%define _savedEdi$ _savedEsi$ - REGISTER_SIZE
%define _contArgHigh32Bits$ _savedEdi$ - REGISTER_SIZE
%define _firstFrameLocal$ _savedEdi$ - REGISTER_SIZE
%define _contArgLow32Bits$ _contArgHigh32Bits$ - REGISTER_SIZE
%define _contVsh$ _contArgLow32Bits$ - REGISTER_SIZE
%define _contEip$ _contVsh$ - REGISTER_SIZE
%define _contStart$ _contVsh$ - REGISTER_SIZE
%define _realM2uUnwinder$ _contStart$ - REGISTER_SIZE
;; end of core VSE fields
%define _targetContinuation$ _realM2uUnwinder$ - REGISTER_SIZE
%define _nextVsePtr$ _targetContinuation$ - REGISTER_SIZE
%define _frameType$ _nextVsePtr$ - REGISTER_SIZE
%define _vsePtr$ _nextVsePtr$ - REGISTER_SIZE
%define _normalEsp$ _nextVsePtr$ - REGISTER_SIZE
;; start of VSE
%define M2UFRAMESIZE (((_firstFrameLocal$) - (_normalEsp$)) + (REGISTER_SIZE))
prtInvokeUnmanagedIntRet:
prtInvokeUnmanagedFunc:
prt_InvokeUnmanagedFuncStart:
getTlsIntoEax ; // leaves eax set to TLS, edx set to mcrtThread
fullStubProlog ; // basic ebp-based frame prolog that saves ebx, esi, edi
sub esp, M2UFRAMESIZE ; // reserve space for rest of the frame and local vars.
mov dword [ ebp + _realM2uUnwinder$ ], prtPillarCompilerUnwinder
pushVse _vsePtr$, prt_InvokeUnmanagedFuncDestructor
push eax
call dword prtToUnmanaged
pop eax
;mov dword [ebp+_callsite_id$], 0 ; // 0 in contArgLow32Bits means we're at the unmanaged call site
copyArgs _argStart$ , _argSize$ ; // reserve space and copy arguments, sets ebx = number of arg bytes
call dword [ ebp + _unmanagedFunc$ ]
prt_InvokeUnmanagedFuncPostCall:
mov ecx, [ ebp + _callingConvention$ ] ; // ecx != 0 if target is a stdcall
cmp ecx, 0
jnz end_cc_check
add esp, ebx
end_cc_check:
prt_InvokeUnmanagedFuncAfterCall:
restoreTlsRegister
mov savereg1, eax ; // save possible return registers away
mov savereg2, edx ; // save possible return registers away
; // we use targetContinuation field here because we no longer need it
; // for fat cuts. We use it to indicate we are at the prtYieldUnmanaged callsite
; // rather than the call to the unmanaged function.
; mov dword [ebp+_callsite_id$], 1
; call prtYieldUnmanaged
getTlsIntoEax ; // get current Prt_Task pointer
push eax
call dword prtToManaged
pop eax
popVse _vsePtr$, prt_InvokeUnmanagedFuncDestructor
mov eax, savereg1 ; // restore return registers
mov edx, savereg2
add esp, M2UFRAMESIZE ; // remove the rest of the frame and local vars
fullStubEpilog
ret 16
prt_InvokeUnmanagedFuncDestructor:
continuationProlog _normalEsp$, _vsePtr$
push dword [ ebp + _targetContinuation$ ] ; // recut
call dword prtFatCutTo
prt_InvokeUnmanagedFuncUnwindContinuation:
continuationProlog _normalEsp$, _contStart$
mov eax, [ebp+_contArgLow32Bits$]
mov edx, [ebp+_contArgHigh32Bits$]
jmp prt_InvokeUnmanagedFuncAfterCall
prt_InvokeUnmanagedFuncEnd:
; ==============================================================================
global prt_PcallDestructor
prt_PcallDestructor:
mov esp, edx
%ifdef TLS_REGISTER
loadTlsRegister
%endif
push 0
push 0
push 0
push prt_PrintIllegalCutMessage
call dword prtInvokeUnmanagedFunc
call dword prt_ExitThread
; ==============================================================================
%macro setNextConstant 2
mov eax, [esp + %2 ]
mov dword [eax], %1
%endmacro
global prt_getStubConstants ; start of the function
prt_getStubConstants:
setNextConstant PRT_TASK_LAST_VSE , REGISTER_SIZE*1
setNextConstant PRT_TASK_USER_TLS , REGISTER_SIZE*2
setNextConstant PRT_TASK_THREAD_HANDLE , REGISTER_SIZE*3
setNextConstant PRT_VSE_ENTRY_TYPE_CODE , REGISTER_SIZE*4
setNextConstant PRT_VSE_NEXT_FRAME , REGISTER_SIZE*5
setNextConstant PRT_VSE_TARGET_CONTINUATION , REGISTER_SIZE*6
setNextConstant CONTINUATION_EIP_OFFSET , REGISTER_SIZE*7
ret
; ==============================================================================
global prt_getCurrentEsp
prt_getCurrentEsp:
mov eax, esp
ret
; ==============================================================================
global prtThinCutTo
%define _continuation$ 4
prtThinCutTo:
%ifdef TLS_REGISTER
loadTlsRegister
%endif
mov edx, [ esp + _continuation$ ]
jmp dword [edx+CONTINUATION_EIP_OFFSET]
; ==============================================================================
global prtYieldUntilDestructor
prtYieldUntilDestructor:
mov edx, [edx+8] ; // edx = target continuation
push edx
call dword prtFatCutTo
; ==============================================================================
global prt_bootstrapTaskAsm ; start of the function
global prt_bootstrapTaskAsmCall
; // Stack offsets of this function's aguments.
%define _cimCreated$ REGISTER_SIZE + REGISTER_SIZE
%define _funcToCall$ _cimCreated$ + REGISTER_SIZE
%define _argStart$ _funcToCall$ + REGISTER_SIZE
%define _argSize$ _argStart$ + REGISTER_SIZE
prt_bootstrapTaskAsm:
fullStubProlog
prt_bootstrapTaskAsmStart:
mov esi, [ ebp + _cimCreated$ ]
test esi, esi
jne cimAlreadyCreated
mov eax, prt_bootstrapTaskAsmEnd
; lea eax, prt_bootstrapTaskAsmEnd
push eax
mov eax, prt_bootstrapTaskAsmStart
; lea eax, prt_bootstrapTaskAsmStart
push eax
; call [_registerBootstrapTaskCim]
mov edx, registerBootstrapTaskCim
call edx
; call dword _registerBootstrapTaskCim
add esp, 8
cimAlreadyCreated:
;; // get all the needed vars into regs before we update esp in case this is
;; // not an ebp based frame.
mov edx, [ebp + _funcToCall$ ]
copyArgs _argStart$ , _argSize$ ; // reserve space and copy arguments
%ifdef TLS_REGISTER
push edx
mov edx, prt_GetTaskNonInline
call edx
mov tlsreg, eax
; loadTlsRegister
pop edx
%endif
; mov edx, edx
call edx ; // invoke the function
; call dword edx ; // invoke the function
prt_bootstrapTaskAsmCall:
call dword prt_ExitThread ; // exit the thread
prt_bootstrapTaskAsmEnd:
; ==============================================================================
; // Stack offsets of this function's aguments.
%define _funcToCall$ REGISTER_SIZE + REGISTER_SIZE
%define _stackTop$ _funcToCall$ + REGISTER_SIZE
global prt_testStackSize ; start of the function
prt_testStackSize:
fullStubProlog
%ifdef TLS_REGISTER
loadTlsRegister
%endif
mov esi, esp
mov edx, [ebp + _funcToCall$] ; // edx = the function to invoke
mov esp, [ebp + _stackTop$ ] ; // transition to a new stack
call edx ; // invoke the function
mov esp, esi
fullStubEpilog
ret
; ==============================================================================
global prt_pcallAsm ; start of the function
; // Stack offsets of this function's aguments.
%define _newEsp$ REGISTER_SIZE + REGISTER_SIZE
prt_pcallAsm:
fullStubProlog
mov esi, esp
mov esp, [ebp + _newEsp$ ]
call dword pcallOnSystemStack
mov esp, esi
fullStubEpilog
ret
; ==============================================================================
; // void * __pdecl prt_getTlsRegister(void);
global prt_getTlsRegister
global prt_getTlsRegisterStart
global prt_getTlsRegisterEnd
prt_getTlsRegister:
prt_getTlsRegisterStart:
%ifdef TLS_REGISTER
mov eax, tlsreg
%else
mov eax, 0
%endif
ret
prt_getTlsRegisterEnd:
; ==============================================================================
; = __x86_64__ =
; ==============================================================================
%else ; // __x86_64__
; // Like getTlsIntoEax below but always refreshes tlsreg from the current thread's TLS.
%macro loadTlsRegister 0
call prt_GetTaskNonInline
mov tlsreg, rax
%endmacro
%define ARG_REG1 rdi
%define ARG_REG2 rsi
%define ARG_REG3 rdx
%define ARG_REG4 rcx
%define ARG_REG5 r8
%define ARG_REG6 r9
; // Copies a function's arguments to its frame. Also reserves space in the frame for the copied arguments.
; // Leaves rax and rdx untouched.
; // At completion, rsi = size of args in bytes, rcx/rdx/r8/r9 are the args to the next function, rdi is trashed.
; // startReg and sizeReg should not be rbx, rcx, rsi or rdi.
; %macro copyArgs %1 = startReg, %2 = sizeReg
;%macro copyArgs 2
; r11 = startReg, r12 = sizeReg
%macro copyArgs 0
mov r13, r12 ;; // r13 = number of 8-byte params
shl r13, 3 ;; // r13 = size of params in bytes
mov r14, rsp ;; // r14 = current stack pointer
sub r14, r13 ;; // r14 = minimum required stack space
mov rax, 0FFffFFffFFffFFf0h ;; // and then and'ing by 16 for alignment
and r14, rax ;; // and then and'ing by 16 for alignment
mov r13, rsp ;; // calculate how much space we actually need with alignment
sub r13, r14 ;; // r13 = how much extra stack space we need
sub rsp, r13 ;; // adjust rsp by that amount
;; // copy the stack arguments to the next stack location starting at esp.
cld
mov rcx, r12 ;; // arg size
mov rsi, r11 ;; // arg start
mov rdi, rsp ;; // place to copy
;; // rep movsd copies "rcx" dwords from [rsi] to [rdi]. cld means rsi and rdi are incremented after each copy.
rep movsq
; // MOVE ARGS INTO REGISTERS? BUT WE DON'T HAVE TYPE INFORMATION!!!
mov rdi, qword [rsp+0]
movq xmm0, rdi
mov rsi, qword [rsp+8]
movq xmm1, rsi
mov rdx, qword [rsp+16]
movq xmm2, rdx
mov rcx, qword [rsp+24]
movq xmm3, rcx
mov r8, qword [rsp+32]
movq xmm4, r8
mov r9, qword [rsp+40]
movq xmm5, r9
mov r11, r13 ;; // r11 = space subtracted from stack
mov r12, r13 ; 8, 16, 56, 64 ;; // r12 = space subtracted from stack
mov r15, r13 ; 8, 16, 56, 64 ;; // r15 = space subtracted from stack
and r13, rax ; 0, 16, 48, 64 ;; // r13 = space subtracted on 16-byte align
not rax ;; // invert mask to get the remainder
and r15, rax ; 8, 0, 8, 0 ;; // r15 = 0 if stack space was 16-byte aligned, 8 otherwise
sub r13, 48 ; -, -, 0, 16 ;; // see if all arguments can be passed in regs (6 regs * 8 bytes = 48)
mov r14, r13 ;; // r14 = amount of stack space used greater than max reg args
sar r14, 63 ;; // make r14 either all 'F' or all '0' depending on sign of r13
not r14 ; 0, 0, 1, 1 ;; // r14 = 0 if r13 is negative, all '1' otherwise
and r13, r14 ; 0, 0, 0, 16 ;; // r13 = 0 if registers enough for args, else amount of args on stack
add r13, r15 ; 8, 0, 8, 16 ;; // r13 = amount of stack to keep adjusted for alignment
sub r12, r13 ; 0, 16, 48, 48 ;; // r12 = amount to add to rsp to "pop" the args that go in regs
add rsp, r12 ;; // pop
sub r11, r12 ;; // r11 = amount we need to add to rsp after the call is complete
mov r12, r11 ;; // r12 = save this amount in the callee-saved register r12
%endmacro
; // Restore the original frame's ebp and esp values using edx, which points to a VSE embedded in the frame.
; %macro continuationProlog %1 = espOffsetFromEbp, %2 = vseOffsetFromEbp
%macro continuationProlog 2
lea rsp, [rdx - %2 + %1]
lea rbp, [rdx - %2]
%endmacro
; // Returns the current thread's TLS (its PrtTask pointer) in eax. Leaves other registers unchanged.
%macro getTlsIntoEax 0
%ifdef TLS_REGISTER
mov rax, tlsreg
%else
call qword prt_GetTaskNonInline
%endif
%endmacro
;TLS_REGISTER = "rbx"
; Check for a valid TLS_REGISTER setting.
%ifdef TLS_REGISTER
%if TLS_REGISTER == "rbx"
;ECHO Using rbx as TLS register.
%define tlsreg rbx
%define savereg1 rsi
%define savereg2 rdi
%macro restoreTlsRegister 0
mov tlsreg, [ rbp + _savedRbx$ ]
%endmacro
%else
;ECHO Error: TLS_REGISTER should be set to "ebx" or left unset.
.ERR
%endif
%else
%define savereg1 rsi
%define savereg2 rdi
%macro restoreTlsRegister 0
%endmacro
%endif
; =============================================================================================
global prtWatermarkPrototype
global prt_WatermarkPrototypeStart
global prt_WatermarkPostTopIndex1
global prt_WatermarkPostStubStackStart
global prt_WatermarkPostStubStart
global prt_WatermarkPostRealEipMove
global prt_WatermarkPrototypeEnd
prtWatermarkPrototype:
prt_WatermarkPrototypeStart:
mov rdx, 01F2f3F4f5F6f7F8fh
prt_WatermarkPostTopIndex1:
mov ecx, dword [rdx] ; // ecx = current top index
inc ecx ; // ecx = new top index
mov dword [rdx], ecx ; // increment the stack's top
mov rdx, 01F2f3F4f5F6f7F8fh
prt_WatermarkPostStubStackStart:
lea rcx, [rdx+rcx*REGISTER_SIZE] ; // ecx = address of the top free stub stack array entry
mov rdx, 01F2f3F4f5F6f7F8fh
prt_WatermarkPostStubStart:
mov qword [rcx], rdx ; // write the stub start value into the stub stack array
mov rcx, 01F2f3F4f5F6f7F8fh
prt_WatermarkPostRealEipMove:
jmp rcx ; // any jump target will do...will be replaced in each copy of the stub
prt_WatermarkPrototypeEnd:
; ==============================================================================
; // void __pdecl prtYield(void);
global prtYield
global prt_YieldStart
global prt_YieldEnd
prtYield:
prt_YieldStart:
ret
prt_YieldEnd:
; ==============================================================================
; // void __stdcall prtInvokeManagedFunc(PrtCodeAddress managedFunc, void *argStart, unsigned argSize);
; // Export the different locations within the prtInvokeManagedFunc function.
global prtInvokeManagedFunc ; start of the function
global prtInvokeManagedIntRet ; start of the function
global prt_InvokeManagedFuncStart ; start of the function
global prt_InvokeManagedFuncUnwindContinuation
global prt_InvokeManagedFuncEnd ; end of the function
; // Stack offsets of this function's aguments.
%define _managedFunc$ REGISTER_SIZE + REGISTER_SIZE
%define _argStart$ _managedFunc$ + REGISTER_SIZE
%define _argSize$ _argStart$ + REGISTER_SIZE
; // Stack frame layout:
; ebp+0: saved ebp
; ebp-4: saved ebx
; ebp-8: saved esi
; ebp-12: saved edi
%define _savedEbx$ -REGISTER_SIZE
%define _savedEsi$ _savedEbx$ - REGISTER_SIZE
%define _savedEdi$ _savedEsi$ - REGISTER_SIZE
%define _contArgHigh32Bits$ _savedEdi$ - REGISTER_SIZE
%define _firstFrameLocal$ _savedEdi$ - REGISTER_SIZE ; intentionally same
%define _contArgLow32Bits$ _contArgHigh32Bits$ - REGISTER_SIZE
%define _contVsh$ _contArgLow32Bits$ - REGISTER_SIZE
%define _contEip$ _contVsh$ - REGISTER_SIZE
%define _contStart$ _contVsh$ - REGISTER_SIZE
%define _normalEsp$ _contVsh$ - REGISTER_SIZE
%define U2MFRAMESIZE (((_firstFrameLocal$) - (_normalEsp$)) + (REGISTER_SIZE))
prtInvokeManagedIntRet:
prtInvokeManagedFunc:
prt_InvokeManagedFuncStart:
; // WE NEVER USE THIS SO IT IS COMPLETELY ATROPHIED!!!!!!!!!!!!!!!!!!!!!!
;fullStubProlog ; // basic ebp-based frame prolog that saves ebx, esi, edi
mov rax, ARG_REG1
sub rsp, U2MFRAMESIZE
copyArgs ; // reserve space and copy arguments
;copyArgs ARG_REG2 , ARG_REG3 ; // reserve space and copy arguments
%ifdef TLS_REGISTER
loadTlsRegister
%endif
call rax ; // call the managed function. don't disturb the return registers after this
prt_InvokeManagedFuncAfterCall:
add rsp, rsi
add rsp, U2MFRAMESIZE
;fullStubEpilog
ret
prt_InvokeManagedFuncUnwindContinuation:
continuationProlog _normalEsp$, _contStart$
mov rax, qword [ rbp + _contArgLow32Bits$ ]
mov rdx, qword [ rbp + _contArgHigh32Bits$ ]
jmp prt_InvokeManagedFuncAfterCall
prt_InvokeManagedFuncEnd:
; ==============================================================================
; // void __stdcall prtInvokeUnmanagedFunc(PrtCodeAddress unmanagedFunc, void *argStart, unsigned argSize, PrtCallingConvention callingConvention);
global prtInvokeUnmanagedFunc ; start of the function
global prtInvokeUnmanagedIntRet ; start of the function
global prt_InvokeUnmanagedFuncStart ; start of the function
global prt_InvokeUnmanagedFuncPostCall ;
global prt_InvokeUnmanagedFuncDestructor ; VSE type identifier (code address)
global prt_InvokeUnmanagedFuncUnwindContinuation
global prt_InvokeUnmanagedFuncEnd ; end of the function
; // Stack offsets of this function's aguments.
;%define _unmanagedFunc$ REGISTER_SIZE + REGISTER_SIZE
;%define _argStart$ _unmanagedFunc$ + REGISTER_SIZE
;%define _argSize$ _argStart$ + REGISTER_SIZE
;%define _callingConvention$ _argSize$ + REGISTER_SIZE
; // Keep these offsets up to date with the definition of struct Prt_M2uFrame.
; Stack frame layout:
; ebp+0: saved rbp
; ebp-8: saved rbx
; ebp-16: saved r12
; ebp-24: saved r13
; ebp-32: saved r14
; ebp-40: saved r15
%define _savedRbx$ -REGISTER_SIZE
%define _savedR12$ _savedRbx$ - REGISTER_SIZE
%define _savedR13$ _savedR12$ - REGISTER_SIZE
%define _savedR14$ _savedR13$ - REGISTER_SIZE
%define _savedR15$ _savedR14$ - REGISTER_SIZE
%define _contArg$ _savedR15$ - REGISTER_SIZE
%define _firstFrameLocal$ _savedR15$ - REGISTER_SIZE
%define _contVsh$ _contArg$ - REGISTER_SIZE
%define _contEip$ _contVsh$ - REGISTER_SIZE
%define _contStart$ _contVsh$ - REGISTER_SIZE
%define _realM2uUnwinder$ _contStart$- REGISTER_SIZE
;; end of core VSE fields
%define _targetContinuation$ _realM2uUnwinder$ - REGISTER_SIZE
%define _nextVsePtr$ _targetContinuation$ - REGISTER_SIZE
%define _frameType$ _nextVsePtr$ - REGISTER_SIZE
%define _vsePtr$ _nextVsePtr$ - REGISTER_SIZE
%define _normalEsp$ _nextVsePtr$ - REGISTER_SIZE
;; start of VSE
;%define M2UFRAMESIZE (((_firstFrameLocal$) - (_normalEsp$)) + (REGISTER_SIZE))
;%define ODD_ARG_MOD ((6*REGISTER_SIZE + M2UFRAMESIZE) % 16)
;%define EVEN_ARG_MOD ((5*REGISTER_SIZE + M2UFRAMESIZE) % 16)
prtInvokeUnmanagedIntRet:
prtInvokeUnmanagedFunc:
prt_InvokeUnmanagedFuncStart:
push rbp
mov rbp, rsp
push rbx
push r12
push r13
push r14
push r15
sub rsp, 7*REGISTER_SIZE ; // make space for M2U frame (6 registers) and align rsp
mov r14, ARG_REG3 ; // save args in callee-saves
mov r13, ARG_REG2
mov r12, ARG_REG1
getTlsIntoEax
mov qword [rbp + _realM2uUnwinder$], prtPillarCompilerUnwinder
; pushVse _vsePtr$ , prt_InvokeUnmanagedFuncDestructor ; // doesn't modify input args
; mov r10, %2 ; // VseType
mov qword [rbp + _frameType$], prt_InvokeUnmanagedFuncDestructor
mov r10, [rax+PRT_TASK_LAST_VSE] ; // get last VSE from Prt_Task into r10
mov qword [rbp + _nextVsePtr$], r10 ; // link up this VSE with the previous one
mov qword [rbp + _targetContinuation$], 0 ; // initialize targetContinuation to 0
lea r10, [rbp + _vsePtr$] ; // get address of new VSE in r10
mov [rax+PRT_TASK_LAST_VSE], r10 ; // set last VSE in Prt_Task to the new VSE
mov ARG_REG1, rax ; // rcx = Tls sub rsp, ODD_ARG_MOD
call prtToUnmanaged
mov r10, r12
mov r11, r13
mov r12, r14
copyArgs ; // reserve space and copy arguments, rsi = size of args
call r10
add rsp, r12
prt_InvokeUnmanagedFuncPostCall:
prt_InvokeUnmanagedFuncAfterCall:
mov r12, rax ; // save result away in r12
restoreTlsRegister
getTlsIntoEax
mov ARG_REG1, rax
call prtToManaged
getTlsIntoEax
; popVse _vsePtr$, prt_InvokeUnmanagedFuncDestructor
mov rcx, [rax+PRT_TASK_LAST_VSE]
mov rcx, [rcx+PRT_VSE_NEXT_FRAME]
mov [rax+PRT_TASK_LAST_VSE], rcx
mov rax, r12 ; // restore return value
add rsp, 7*REGISTER_SIZE ; // remove the rest of the frame and local vars
pop r15
pop r14
pop r13
pop r12
pop rbx
pop rbp
ret
prt_InvokeUnmanagedFuncDestructor:
continuationProlog _normalEsp$, _vsePtr$
mov ARG_REG1, [rbp+_targetContinuation$] ; // recut
sub rsp, 32
call prtFatCutTo
prt_InvokeUnmanagedFuncUnwindContinuation:
continuationProlog _normalEsp$, _contStart$
mov rax, [rbp+_contArgLow32Bits$]
mov rdx, [rbp+_contArgHigh32Bits$]
jmp prt_InvokeUnmanagedFuncAfterCall
prt_InvokeUnmanagedFuncEnd:
; =============================================================================================
global prt_PcallDestructor
prt_PcallDestructor:
mov rsp, rdx
mov rax, rsp
and rax, 0Fh
sub rsp, rax ; // align rsp
%ifdef TLS_REGISTER
loadTlsRegister
%endif
mov ARG_REG4, 0
mov ARG_REG3, 0
mov ARG_REG2, 0
mov ARG_REG1, prt_PrintIllegalCutMessage
call prtInvokeUnmanagedFunc
call prt_ExitThread
; =============================================================================================
global prt_getStubConstants ; start of the function
prt_getStubConstants:
mov qword [rdi], PRT_TASK_LAST_VSE
mov qword [rsi], PRT_TASK_USER_TLS
mov qword [rdx], PRT_TASK_THREAD_HANDLE
mov qword [rcx], PRT_VSE_ENTRY_TYPE_CODE
mov qword [r8], PRT_VSE_NEXT_FRAME
mov qword [r9], PRT_VSE_TARGET_CONTINUATION
mov rax, [rsp + REGISTER_SIZE]
mov qword [rax], CONTINUATION_EIP_OFFSET
ret
; =============================================================================================
global prt_getCurrentEsp
prt_getCurrentEsp:
mov rax, rsp
ret
; =============================================================================================
global prtThinCutTo
prtThinCutTo:
mov rdx, ARG_REG1
mov rax, [rdx+CONTINUATION_EIP_OFFSET]
jmp rax
; =============================================================================================
global prt_bootstrapTaskAsm ; start of the function
global prt_bootstrapTaskAsmCall
global prt_bootstrapTaskAsmStart
global prt_bootstrapTaskAsmEnd
; // Stack offsets of this function's aguments.
%define _cimCreated$ REGISTER_SIZE + REGISTER_SIZE
%define _funcToCall$ _cimCreated$ + REGISTER_SIZE
%define _argStart$ _funcToCall$ + REGISTER_SIZE
%define _argSize$ _argStart$ + REGISTER_SIZE
prt_bootstrapTaskAsm:
prt_bootstrapTaskAsmStart:
; // This function never returns so don't bother saving the callee-save registers
; // even though we use them.
push rcx ; // argSize
push rdx ; // argStart
push rsi ; // function to call, by pushing 3 registers we align rsp
test rdi, rdi
jne cimAlreadyCreated
mov rsi, prt_bootstrapTaskAsmEnd
mov rdi, prt_bootstrapTaskAsmStart
call registerBootstrapTaskCim
cimAlreadyCreated:
%ifdef TLS_REGISTER
loadTlsRegister
%endif
pop r10 ; // function to call
pop r11 ; // argStart
pop r12 ; // argSize
copyArgs ; // r10, r11
call r10
prt_bootstrapTaskAsmCall:
add rsp, r12
call prt_ExitThread ;; // exit the thread
prt_bootstrapTaskAsmEnd:
; =============================================================================================
global prt_pcallAsm ; start of the function
prt_pcallAsm:
push r12
mov r12, rsp
mov rsp, ARG_REG1
mov ARG_REG1, [rsp+0]
mov ARG_REG2, [rsp+1*REGISTER_SIZE]
mov ARG_REG3, [rsp+2*REGISTER_SIZE]
mov ARG_REG4, [rsp+3*REGISTER_SIZE]
mov rax, rsp
and rax, 0Fh
sub rsp, rax ; // align rsp
call pcallOnSystemStack
mov rsp, r12
pop r12
ret
; =============================================================================================
global prt_testStackSize ; start of the function
; // Stack offsets of this function's aguments.
%define _funcToCall$ REGISTER_SIZE + REGISTER_SIZE
%define _stackTop$ _funcToCall$ + REGISTER_SIZE
prt_testStackSize:
push rbp
mov rbp, rsp
push rbx
push r12
push r13
push r13
push r15
mov r12, ARG_REG1
mov r13, ARG_REG2
%ifdef TLS_REGISTER
loadTlsRegister
%endif
mov ARG_REG1, r12
mov ARG_REG2, r13
mov r12, rsp
mov rsp, ARG_REG2 ;; // transition to a new stack
sub rsp, 40
call ARG_REG1 ;; // invoke the function
add rsp, 40
mov rsp, r12
pop r15
pop r14
pop r13
pop r12
pop rbx
pop rbp
ret
; =============================================================================================
; // void * __pdecl prt_getTlsRegister(void);
global prt_getTlsRegister
global prt_getTlsRegisterStart
global prt_getTlsRegisterEnd
prt_getTlsRegister:
prt_getTlsRegisterStart:
%ifdef TLS_REGISTER
mov rax, tlsreg
%else
mov rax, 0
%endif
ret
prt_getTlsRegisterEnd:
; =============================================================================================
global prtYieldUntilDestructor
prtYieldUntilDestructor:
mov rcx, [rdx+8] ; // edx = target continuation
push rcx
call qword prtFatCutTo
; ==============================================================================
%endif ; //__x86_64__
|
; check wether given string is palindrome or not
.model small
.stack
.data
str db 40 dup('$')
rev db 40 dup('$')
msg db 10,13,"Enter the string : $"
msgr db 10,13,"Reverse of the ginen string is:$"
pal db 10,13,"the string is palindrome $"
npal db 10,13,"the string is not palindrome $"
.code
mov ax,@data
mov ds,ax
mov es,ax
; reading the string from keybaord
lea dx,msg
mov ah,09h
int 21h
xor cx,cx ; as cx is default counter
lea si,str
read:
mov ah,01h
int 21h
cmp al,0dh ; comparing the entered character with \n
je next ; if true break the loop
mov [si],al
inc cx
inc si
jmp read
next:
lea di,rev
mov bp,cx ; storing the cx value in bp
revstr:
dec si
mov al,[si]
mov [di],al
inc di
loop revstr ; here the cx value is automatically decreased
lea dx,msgr
mov ah,09h
int 21h
lea dx,rev
mov ah,09h
int 21h
lea si,str
lea di,rev
mov cx,bp
repe cmpsb
jnz fail
lea dx,pal
jmp exit
fail:
lea dx,npal
exit:
mov ah,09h
int 21h
mov ah,4ch
int 21h
end
|
#include <algorithm>
#include <cfloat>
#include <vector>
#include <iostream>
#include "caffe/layer.hpp"
#include "caffe/layer_factory.hpp"
#include "caffe/util/math_functions.hpp"
#include "caffe/vision_layers.hpp"
namespace caffe {
template <typename Dtype>
void SoftmaxWithLossLayer<Dtype>::LayerSetUp(
const vector<Blob<Dtype>*>& bottom, const vector<Blob<Dtype>*>& top) {
LossLayer<Dtype>::LayerSetUp(bottom, top);
LayerParameter softmax_param(this->layer_param_);
softmax_param.set_type("Softmax");
softmax_layer_ = LayerRegistry<Dtype>::CreateLayer(softmax_param);
softmax_bottom_vec_.clear();
softmax_bottom_vec_.push_back(bottom[0]);
softmax_top_vec_.clear();
softmax_top_vec_.push_back(&prob_);
softmax_layer_->SetUp(softmax_bottom_vec_, softmax_top_vec_);
has_ignore_label_ =
this->layer_param_.loss_param().has_ignore_label();
if (has_ignore_label_) {
ignore_label_ = this->layer_param_.loss_param().ignore_label();
}
normalize_ = this->layer_param_.loss_param().normalize();
weight_by_label_freqs_ =
this->layer_param_.loss_param().weight_by_label_freqs();
if (weight_by_label_freqs_) {
vector<int> count_shape(1, this->layer_param_.loss_param().class_weighting_size());
label_counts_.Reshape(count_shape);
CHECK_EQ(this->layer_param_.loss_param().class_weighting_size(), bottom[0]->channels())
<< "Number of class weight values does not match the number of classes.";
float* label_count_data = label_counts_.mutable_cpu_data();
for (int i = 0; i < this->layer_param_.loss_param().class_weighting_size(); i++) {
label_count_data[i] = this->layer_param_.loss_param().class_weighting(i);
}
}
}
template <typename Dtype>
void SoftmaxWithLossLayer<Dtype>::Reshape(
const vector<Blob<Dtype>*>& bottom, const vector<Blob<Dtype>*>& top) {
LossLayer<Dtype>::Reshape(bottom, top);
softmax_layer_->Reshape(softmax_bottom_vec_, softmax_top_vec_);
softmax_axis_ =
bottom[0]->CanonicalAxisIndex(this->layer_param_.softmax_param().axis());
outer_num_ = bottom[0]->count(0, softmax_axis_);
inner_num_ = bottom[0]->count(softmax_axis_ + 1);
CHECK_EQ(outer_num_ * inner_num_, bottom[1]->count())
<< "Number of labels must match number of predictions; "
<< "e.g., if softmax axis == 1 and prediction shape is (N, C, H, W), "
<< "label count (number of labels) must be N*H*W, "
<< "with integer values in {0, 1, ..., C-1}.";
if (top.size() >= 2) {
// softmax output
top[1]->ReshapeLike(*bottom[0]);
}
if (weight_by_label_freqs_) {
CHECK_EQ(this->layer_param_.loss_param().class_weighting_size(), bottom[0]->channels())
<< "Number of class weight values does not match the number of classes.";
}
}
template <typename Dtype>
void SoftmaxWithLossLayer<Dtype>::Forward_cpu(
const vector<Blob<Dtype>*>& bottom, const vector<Blob<Dtype>*>& top) {
// The forward pass computes the softmax prob values.
softmax_layer_->Forward(softmax_bottom_vec_, softmax_top_vec_);
const Dtype* prob_data = prob_.cpu_data();
const Dtype* label = bottom[1]->cpu_data();
int dim = prob_.count() / outer_num_;
int count = 0;
Dtype loss = 0;
for (int i = 0; i < outer_num_; ++i) {
for (int j = 0; j < inner_num_; j++) {
const int label_value = static_cast<int>(label[i * inner_num_ + j]);
if (has_ignore_label_ && label_value == ignore_label_) {
continue;
}
DCHECK_GE(label_value, 0);
DCHECK_LT(label_value, prob_.shape(softmax_axis_));
const int idx = i * dim + label_value * inner_num_ + j;
if (weight_by_label_freqs_) {
const float* label_count_data = label_counts_.cpu_data();
loss -= log(std::max(prob_data[idx], Dtype(FLT_MIN)))
* static_cast<Dtype>(label_count_data[label_value]);
} else {
loss -= log(std::max(prob_data[idx], Dtype(FLT_MIN)));
}
++count;
}
}
if (normalize_) {
top[0]->mutable_cpu_data()[0] = loss / count;
} else {
top[0]->mutable_cpu_data()[0] = loss / outer_num_;
}
if (top.size() == 2) {
top[1]->ShareData(prob_);
}
}
template <typename Dtype>
void SoftmaxWithLossLayer<Dtype>::Backward_cpu(const vector<Blob<Dtype>*>& top,
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom) {
if (propagate_down[1]) {
LOG(FATAL) << this->type()
<< " Layer cannot backpropagate to label inputs.";
}
if (propagate_down[0]) {
Dtype* bottom_diff = bottom[0]->mutable_cpu_diff();
const Dtype* prob_data = prob_.cpu_data();
caffe_copy(prob_.count(), prob_data, bottom_diff);
const Dtype* label = bottom[1]->cpu_data();
int dim = prob_.count() / outer_num_;
int count = 0;
const float* label_count_data =
weight_by_label_freqs_ ? label_counts_.cpu_data() : NULL;
for (int i = 0; i < outer_num_; ++i) {
for (int j = 0; j < inner_num_; ++j) {
const int label_value = static_cast<int>(label[i * inner_num_ + j]);
if (has_ignore_label_ && label_value == ignore_label_) {
for (int c = 0; c < bottom[0]->shape(softmax_axis_); ++c) {
bottom_diff[i * dim + c * inner_num_ + j] = 0;
}
} else {
const int idx = i * dim + label_value * inner_num_ + j;
bottom_diff[idx] -= 1;
if (weight_by_label_freqs_) {
for (int c = 0; c < bottom[0]->shape(softmax_axis_); ++c) {
bottom_diff[i * dim + c * inner_num_ + j] *= static_cast<Dtype>(label_count_data[label_value]);
}
}
++count;
}
}
}
// Scale gradient
const Dtype loss_weight = top[0]->cpu_diff()[0];
if (normalize_) {
caffe_scal(prob_.count(), loss_weight / count, bottom_diff);
} else {
caffe_scal(prob_.count(), loss_weight / outer_num_, bottom_diff);
}
}
}
#ifdef CPU_ONLY
STUB_GPU(SoftmaxWithLossLayer);
#endif
INSTANTIATE_CLASS(SoftmaxWithLossLayer);
REGISTER_LAYER_CLASS(SoftmaxWithLoss);
} // namespace caffe
|
/* This is an assembly language implementation of mulsi3, divsi3, and modsi3
for the sparc processor.
These routines are derived from the SPARC Architecture Manual, version 8,
slightly edited to match the desired calling convention, and also to
optimize them for our purposes. */
#ifdef L_mulsi3
.text
.align 4
.global .umul
.proc 4
.umul:
or %o0, %o1, %o4 ! logical or of multiplier and multiplicand
mov %o0, %y ! multiplier to Y register
andncc %o4, 0xfff, %o5 ! mask out lower 12 bits
be mul_shortway ! can do it the short way
andcc %g0, %g0, %o4 ! zero the partial product and clear NV cc
!
! long multiply
!
mulscc %o4, %o1, %o4 ! first iteration of 33
mulscc %o4, %o1, %o4
mulscc %o4, %o1, %o4
mulscc %o4, %o1, %o4
mulscc %o4, %o1, %o4
mulscc %o4, %o1, %o4
mulscc %o4, %o1, %o4
mulscc %o4, %o1, %o4
mulscc %o4, %o1, %o4
mulscc %o4, %o1, %o4
mulscc %o4, %o1, %o4
mulscc %o4, %o1, %o4
mulscc %o4, %o1, %o4
mulscc %o4, %o1, %o4
mulscc %o4, %o1, %o4
mulscc %o4, %o1, %o4
mulscc %o4, %o1, %o4
mulscc %o4, %o1, %o4
mulscc %o4, %o1, %o4
mulscc %o4, %o1, %o4
mulscc %o4, %o1, %o4
mulscc %o4, %o1, %o4
mulscc %o4, %o1, %o4
mulscc %o4, %o1, %o4
mulscc %o4, %o1, %o4
mulscc %o4, %o1, %o4
mulscc %o4, %o1, %o4
mulscc %o4, %o1, %o4
mulscc %o4, %o1, %o4
mulscc %o4, %o1, %o4
mulscc %o4, %o1, %o4
mulscc %o4, %o1, %o4 ! 32nd iteration
mulscc %o4, %g0, %o4 ! last iteration only shifts
! the upper 32 bits of product are wrong, but we do not care
retl
rd %y, %o0
!
! short multiply
!
mul_shortway:
mulscc %o4, %o1, %o4 ! first iteration of 13
mulscc %o4, %o1, %o4
mulscc %o4, %o1, %o4
mulscc %o4, %o1, %o4
mulscc %o4, %o1, %o4
mulscc %o4, %o1, %o4
mulscc %o4, %o1, %o4
mulscc %o4, %o1, %o4
mulscc %o4, %o1, %o4
mulscc %o4, %o1, %o4
mulscc %o4, %o1, %o4
mulscc %o4, %o1, %o4 ! 12th iteration
mulscc %o4, %g0, %o4 ! last iteration only shifts
rd %y, %o5
sll %o4, 12, %o4 ! left shift partial product by 12 bits
srl %o5, 20, %o5 ! right shift partial product by 20 bits
retl
or %o5, %o4, %o0 ! merge for true product
#endif
#ifdef L_divsi3
/*
* Division and remainder, from Appendix E of the SPARC Version 8
* Architecture Manual, with fixes from Gordon Irlam.
*/
/*
* Input: dividend and divisor in %o0 and %o1 respectively.
*
* m4 parameters:
* .div name of function to generate
* div div=div => %o0 / %o1; div=rem => %o0 % %o1
* true true=true => signed; true=false => unsigned
*
* Algorithm parameters:
* N how many bits per iteration we try to get (4)
* WORDSIZE total number of bits (32)
*
* Derived constants:
* TOPBITS number of bits in the top decade of a number
*
* Important variables:
* Q the partial quotient under development (initially 0)
* R the remainder so far, initially the dividend
* ITER number of main division loop iterations required;
* equal to ceil(log2(quotient) / N). Note that this
* is the log base (2^N) of the quotient.
* V the current comparand, initially divisor*2^(ITER*N-1)
*
* Cost:
* Current estimate for non-large dividend is
* ceil(log2(quotient) / N) * (10 + 7N/2) + C
* A large dividend is one greater than 2^(31-TOPBITS) and takes a
* different path, as the upper bits of the quotient must be developed
* one bit at a time.
*/
.global .udiv
.align 4
.proc 4
.text
.udiv:
b ready_to_divide
mov 0, %g3 ! result is always positive
.global .div
.align 4
.proc 4
.text
.div:
! compute sign of result; if neither is negative, no problem
orcc %o1, %o0, %g0 ! either negative?
bge ready_to_divide ! no, go do the divide
xor %o1, %o0, %g3 ! compute sign in any case
tst %o1
bge 1f
tst %o0
! %o1 is definitely negative; %o0 might also be negative
bge ready_to_divide ! if %o0 not negative...
sub %g0, %o1, %o1 ! in any case, make %o1 nonneg
1: ! %o0 is negative, %o1 is nonnegative
sub %g0, %o0, %o0 ! make %o0 nonnegative
ready_to_divide:
! Ready to divide. Compute size of quotient; scale comparand.
orcc %o1, %g0, %o5
bne 1f
mov %o0, %o3
! Divide by zero trap. If it returns, return 0 (about as
! wrong as possible, but that is what SunOS does...).
ta 0x2 ! ST_DIV0
retl
clr %o0
1:
cmp %o3, %o5 ! if %o1 exceeds %o0, done
blu got_result ! (and algorithm fails otherwise)
clr %o2
sethi %hi(1 << (32 - 4 - 1)), %g1
cmp %o3, %g1
blu not_really_big
clr %o4
! Here the dividend is >= 2**(31-N) or so. We must be careful here,
! as our usual N-at-a-shot divide step will cause overflow and havoc.
! The number of bits in the result here is N*ITER+SC, where SC <= N.
! Compute ITER in an unorthodox manner: know we need to shift V into
! the top decade: so do not even bother to compare to R.
1:
cmp %o5, %g1
bgeu 3f
mov 1, %g2
sll %o5, 4, %o5
b 1b
add %o4, 1, %o4
! Now compute %g2.
2: addcc %o5, %o5, %o5
bcc not_too_big
add %g2, 1, %g2
! We get here if the %o1 overflowed while shifting.
! This means that %o3 has the high-order bit set.
! Restore %o5 and subtract from %o3.
sll %g1, 4, %g1 ! high order bit
srl %o5, 1, %o5 ! rest of %o5
add %o5, %g1, %o5
b do_single_div
sub %g2, 1, %g2
not_too_big:
3: cmp %o5, %o3
blu 2b
nop
be do_single_div
nop
/* NB: these are commented out in the V8-SPARC manual as well */
/* (I do not understand this) */
! %o5 > %o3: went too far: back up 1 step
! srl %o5, 1, %o5
! dec %g2
! do single-bit divide steps
!
! We have to be careful here. We know that %o3 >= %o5, so we can do the
! first divide step without thinking. BUT, the others are conditional,
! and are only done if %o3 >= 0. Because both %o3 and %o5 may have the high-
! order bit set in the first step, just falling into the regular
! division loop will mess up the first time around.
! So we unroll slightly...
do_single_div:
subcc %g2, 1, %g2
bl end_regular_divide
nop
sub %o3, %o5, %o3
mov 1, %o2
b end_single_divloop
nop
single_divloop:
sll %o2, 1, %o2
bl 1f
srl %o5, 1, %o5
! %o3 >= 0
sub %o3, %o5, %o3
b 2f
add %o2, 1, %o2
1: ! %o3 < 0
add %o3, %o5, %o3
sub %o2, 1, %o2
2:
end_single_divloop:
subcc %g2, 1, %g2
bge single_divloop
tst %o3
b,a end_regular_divide
not_really_big:
1:
sll %o5, 4, %o5
cmp %o5, %o3
bleu 1b
addcc %o4, 1, %o4
be got_result
sub %o4, 1, %o4
tst %o3 ! set up for initial iteration
divloop:
sll %o2, 4, %o2
! depth 1, accumulated bits 0
bl L1.16
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
! depth 2, accumulated bits 1
bl L2.17
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
! depth 3, accumulated bits 3
bl L3.19
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
! depth 4, accumulated bits 7
bl L4.23
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
b 9f
add %o2, (7*2+1), %o2
L4.23:
! remainder is negative
addcc %o3,%o5,%o3
b 9f
add %o2, (7*2-1), %o2
L3.19:
! remainder is negative
addcc %o3,%o5,%o3
! depth 4, accumulated bits 5
bl L4.21
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
b 9f
add %o2, (5*2+1), %o2
L4.21:
! remainder is negative
addcc %o3,%o5,%o3
b 9f
add %o2, (5*2-1), %o2
L2.17:
! remainder is negative
addcc %o3,%o5,%o3
! depth 3, accumulated bits 1
bl L3.17
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
! depth 4, accumulated bits 3
bl L4.19
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
b 9f
add %o2, (3*2+1), %o2
L4.19:
! remainder is negative
addcc %o3,%o5,%o3
b 9f
add %o2, (3*2-1), %o2
L3.17:
! remainder is negative
addcc %o3,%o5,%o3
! depth 4, accumulated bits 1
bl L4.17
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
b 9f
add %o2, (1*2+1), %o2
L4.17:
! remainder is negative
addcc %o3,%o5,%o3
b 9f
add %o2, (1*2-1), %o2
L1.16:
! remainder is negative
addcc %o3,%o5,%o3
! depth 2, accumulated bits -1
bl L2.15
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
! depth 3, accumulated bits -1
bl L3.15
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
! depth 4, accumulated bits -1
bl L4.15
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
b 9f
add %o2, (-1*2+1), %o2
L4.15:
! remainder is negative
addcc %o3,%o5,%o3
b 9f
add %o2, (-1*2-1), %o2
L3.15:
! remainder is negative
addcc %o3,%o5,%o3
! depth 4, accumulated bits -3
bl L4.13
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
b 9f
add %o2, (-3*2+1), %o2
L4.13:
! remainder is negative
addcc %o3,%o5,%o3
b 9f
add %o2, (-3*2-1), %o2
L2.15:
! remainder is negative
addcc %o3,%o5,%o3
! depth 3, accumulated bits -3
bl L3.13
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
! depth 4, accumulated bits -5
bl L4.11
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
b 9f
add %o2, (-5*2+1), %o2
L4.11:
! remainder is negative
addcc %o3,%o5,%o3
b 9f
add %o2, (-5*2-1), %o2
L3.13:
! remainder is negative
addcc %o3,%o5,%o3
! depth 4, accumulated bits -7
bl L4.9
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
b 9f
add %o2, (-7*2+1), %o2
L4.9:
! remainder is negative
addcc %o3,%o5,%o3
b 9f
add %o2, (-7*2-1), %o2
9:
end_regular_divide:
subcc %o4, 1, %o4
bge divloop
tst %o3
bl,a got_result
! non-restoring fixup here (one instruction only!)
sub %o2, 1, %o2
got_result:
! check to see if answer should be < 0
tst %g3
bl,a 1f
sub %g0, %o2, %o2
1:
retl
mov %o2, %o0
#endif
#ifdef L_modsi3
/* This implementation was taken from glibc:
*
* Input: dividend and divisor in %o0 and %o1 respectively.
*
* Algorithm parameters:
* N how many bits per iteration we try to get (4)
* WORDSIZE total number of bits (32)
*
* Derived constants:
* TOPBITS number of bits in the top decade of a number
*
* Important variables:
* Q the partial quotient under development (initially 0)
* R the remainder so far, initially the dividend
* ITER number of main division loop iterations required;
* equal to ceil(log2(quotient) / N). Note that this
* is the log base (2^N) of the quotient.
* V the current comparand, initially divisor*2^(ITER*N-1)
*
* Cost:
* Current estimate for non-large dividend is
* ceil(log2(quotient) / N) * (10 + 7N/2) + C
* A large dividend is one greater than 2^(31-TOPBITS) and takes a
* different path, as the upper bits of the quotient must be developed
* one bit at a time.
*/
.text
.align 4
.global .urem
.proc 4
.urem:
b divide
mov 0, %g3 ! result always positive
.align 4
.global .rem
.proc 4
.rem:
! compute sign of result; if neither is negative, no problem
orcc %o1, %o0, %g0 ! either negative?
bge 2f ! no, go do the divide
mov %o0, %g3 ! sign of remainder matches %o0
tst %o1
bge 1f
tst %o0
! %o1 is definitely negative; %o0 might also be negative
bge 2f ! if %o0 not negative...
sub %g0, %o1, %o1 ! in any case, make %o1 nonneg
1: ! %o0 is negative, %o1 is nonnegative
sub %g0, %o0, %o0 ! make %o0 nonnegative
2:
! Ready to divide. Compute size of quotient; scale comparand.
divide:
orcc %o1, %g0, %o5
bne 1f
mov %o0, %o3
! Divide by zero trap. If it returns, return 0 (about as
! wrong as possible, but that is what SunOS does...).
ta 0x2 !ST_DIV0
retl
clr %o0
1:
cmp %o3, %o5 ! if %o1 exceeds %o0, done
blu got_result ! (and algorithm fails otherwise)
clr %o2
sethi %hi(1 << (32 - 4 - 1)), %g1
cmp %o3, %g1
blu not_really_big
clr %o4
! Here the dividend is >= 2**(31-N) or so. We must be careful here,
! as our usual N-at-a-shot divide step will cause overflow and havoc.
! The number of bits in the result here is N*ITER+SC, where SC <= N.
! Compute ITER in an unorthodox manner: know we need to shift V into
! the top decade: so do not even bother to compare to R.
1:
cmp %o5, %g1
bgeu 3f
mov 1, %g2
sll %o5, 4, %o5
b 1b
add %o4, 1, %o4
! Now compute %g2.
2: addcc %o5, %o5, %o5
bcc not_too_big
add %g2, 1, %g2
! We get here if the %o1 overflowed while shifting.
! This means that %o3 has the high-order bit set.
! Restore %o5 and subtract from %o3.
sll %g1, 4, %g1 ! high order bit
srl %o5, 1, %o5 ! rest of %o5
add %o5, %g1, %o5
b do_single_div
sub %g2, 1, %g2
not_too_big:
3: cmp %o5, %o3
blu 2b
nop
be do_single_div
nop
/* NB: these are commented out in the V8-SPARC manual as well */
/* (I do not understand this) */
! %o5 > %o3: went too far: back up 1 step
! srl %o5, 1, %o5
! dec %g2
! do single-bit divide steps
!
! We have to be careful here. We know that %o3 >= %o5, so we can do the
! first divide step without thinking. BUT, the others are conditional,
! and are only done if %o3 >= 0. Because both %o3 and %o5 may have the high-
! order bit set in the first step, just falling into the regular
! division loop will mess up the first time around.
! So we unroll slightly...
do_single_div:
subcc %g2, 1, %g2
bl end_regular_divide
nop
sub %o3, %o5, %o3
mov 1, %o2
b end_single_divloop
nop
single_divloop:
sll %o2, 1, %o2
bl 1f
srl %o5, 1, %o5
! %o3 >= 0
sub %o3, %o5, %o3
b 2f
add %o2, 1, %o2
1: ! %o3 < 0
add %o3, %o5, %o3
sub %o2, 1, %o2
2:
end_single_divloop:
subcc %g2, 1, %g2
bge single_divloop
tst %o3
b,a end_regular_divide
not_really_big:
1:
sll %o5, 4, %o5
cmp %o5, %o3
bleu 1b
addcc %o4, 1, %o4
be got_result
sub %o4, 1, %o4
tst %o3 ! set up for initial iteration
divloop:
sll %o2, 4, %o2
! depth 1, accumulated bits 0
bl L1.16
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
! depth 2, accumulated bits 1
bl L2.17
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
! depth 3, accumulated bits 3
bl L3.19
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
! depth 4, accumulated bits 7
bl L4.23
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
b 9f
add %o2, (7*2+1), %o2
L4.23:
! remainder is negative
addcc %o3,%o5,%o3
b 9f
add %o2, (7*2-1), %o2
L3.19:
! remainder is negative
addcc %o3,%o5,%o3
! depth 4, accumulated bits 5
bl L4.21
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
b 9f
add %o2, (5*2+1), %o2
L4.21:
! remainder is negative
addcc %o3,%o5,%o3
b 9f
add %o2, (5*2-1), %o2
L2.17:
! remainder is negative
addcc %o3,%o5,%o3
! depth 3, accumulated bits 1
bl L3.17
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
! depth 4, accumulated bits 3
bl L4.19
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
b 9f
add %o2, (3*2+1), %o2
L4.19:
! remainder is negative
addcc %o3,%o5,%o3
b 9f
add %o2, (3*2-1), %o2
L3.17:
! remainder is negative
addcc %o3,%o5,%o3
! depth 4, accumulated bits 1
bl L4.17
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
b 9f
add %o2, (1*2+1), %o2
L4.17:
! remainder is negative
addcc %o3,%o5,%o3
b 9f
add %o2, (1*2-1), %o2
L1.16:
! remainder is negative
addcc %o3,%o5,%o3
! depth 2, accumulated bits -1
bl L2.15
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
! depth 3, accumulated bits -1
bl L3.15
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
! depth 4, accumulated bits -1
bl L4.15
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
b 9f
add %o2, (-1*2+1), %o2
L4.15:
! remainder is negative
addcc %o3,%o5,%o3
b 9f
add %o2, (-1*2-1), %o2
L3.15:
! remainder is negative
addcc %o3,%o5,%o3
! depth 4, accumulated bits -3
bl L4.13
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
b 9f
add %o2, (-3*2+1), %o2
L4.13:
! remainder is negative
addcc %o3,%o5,%o3
b 9f
add %o2, (-3*2-1), %o2
L2.15:
! remainder is negative
addcc %o3,%o5,%o3
! depth 3, accumulated bits -3
bl L3.13
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
! depth 4, accumulated bits -5
bl L4.11
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
b 9f
add %o2, (-5*2+1), %o2
L4.11:
! remainder is negative
addcc %o3,%o5,%o3
b 9f
add %o2, (-5*2-1), %o2
L3.13:
! remainder is negative
addcc %o3,%o5,%o3
! depth 4, accumulated bits -7
bl L4.9
srl %o5,1,%o5
! remainder is positive
subcc %o3,%o5,%o3
b 9f
add %o2, (-7*2+1), %o2
L4.9:
! remainder is negative
addcc %o3,%o5,%o3
b 9f
add %o2, (-7*2-1), %o2
9:
end_regular_divide:
subcc %o4, 1, %o4
bge divloop
tst %o3
bl,a got_result
! non-restoring fixup here (one instruction only!)
add %o3, %o1, %o3
got_result:
! check to see if answer should be < 0
tst %g3
bl,a 1f
sub %g0, %o3, %o3
1:
retl
mov %o3, %o0
#endif
|
/******************************************************************
*
* Round for C++
*
* Copyright (C) Satoshi Konno 2015
*
* This is licensed under BSD-style license, see file COPYING.
*
******************************************************************/
#include <boost/lexical_cast.hpp>
#include <stdlib.h>
#include <sstream>
#include <round/common/Dictionary.h>
Round::Dictionary::Dictionary() {
}
Round::Dictionary::~Dictionary() {
}
std::size_t Round::Dictionary::getAllKeys(DictionaryKeyList *keyList) const {
for (Dictionary::const_iterator dict = begin(); dict != end(); dict++) {
keyList->addKey(dict->first);
}
return keyList->size();
}
bool Round::Dictionary::set(Dictionary *srcDict) {
if (!srcDict)
return false;
for (Dictionary::iterator dict = srcDict->begin(); dict != srcDict->end(); dict++) {
set(dict->first, dict->second);
}
return true;
}
bool Round::Dictionary::set(const std::string &key, const std::string &value) {
if (key.length() <= 0)
return false;
Dictionary::iterator map = find(key);
if (map == end()) {
insert(std::make_pair(key, value));
}
else {
map->second = value;
}
return true;
}
bool Round::Dictionary::get(const std::string &key, std::string *value) const {
Dictionary::const_iterator dict = find(key);
if (dict == end()) {
*value = "";
return false;
}
*value = dict->second;
return true;
}
bool Round::Dictionary::hasKey(const std::string &key) const {
return (find(key) != end()) ? true : false;
}
bool Round::Dictionary::set(const std::string &key, int value) {
std::string strValue = boost::lexical_cast<std::string>(value);
return set(key, strValue);
}
bool Round::Dictionary::set(const std::string &key, bool value) {
int intValue = value ? 1 : 0;
return set(key, intValue);
}
bool Round::Dictionary::set(const std::string &key, long value) {
std::string strValue = boost::lexical_cast<std::string>(value);
return set(key, strValue);
}
bool Round::Dictionary::set(const std::string &key, size_t value) {
std::string strValue = boost::lexical_cast<std::string>(value);
return set(key, strValue);
}
bool Round::Dictionary::set(const std::string &key, double value) {
std::string strValue = boost::lexical_cast<std::string>(value);
return set(key, strValue);
}
bool Round::Dictionary::get(const std::string &key, int *value) const {
std::string strValue;
if (get(key, &strValue) == false)
return false;
if (strValue.length() <= 0)
return false;
try {
*value = boost::lexical_cast<int>(strValue);
} catch(boost::bad_lexical_cast &) {
return false;
}
return true;
}
bool Round::Dictionary::get(const std::string &key, bool *value) const {
int intValue;
if (get(key, &intValue) == false)
return false;
try {
*value = (intValue == 0) ? false : true;
} catch(boost::bad_lexical_cast &) {
return false;
}
return true;
}
bool Round::Dictionary::get(const std::string &key, long *value) const {
std::string strValue;
if (get(key, &strValue) == false)
return false;
if (strValue.length() <= 0)
return false;
try {
*value = boost::lexical_cast<long>(strValue);
} catch(boost::bad_lexical_cast &) {
return false;
}
return true;
}
bool Round::Dictionary::get(const std::string &key, size_t *value) const {
std::string strValue;
if (get(key, &strValue) == false)
return false;
if (strValue.length() <= 0)
return false;
try {
*value = boost::lexical_cast<size_t>(strValue);
} catch(boost::bad_lexical_cast &) {
return false;
}
return true;
}
bool Round::Dictionary::get(const std::string &key, double *value) const {
std::string strValue;
if (get(key, &strValue) == false)
return false;
if (strValue.length() <= 0)
return false;
try {
*value = boost::lexical_cast<double>(strValue);
} catch(boost::bad_lexical_cast &) {
return false;
}
return true;
}
bool Round::Dictionary::remove(const std::string &key) {
Dictionary::iterator dict = find(key);
if (dict == end())
return false;
erase(dict);
return true;
}
|
#include "extensions/tracers/xray/config.h"
#include <string>
#include "envoy/config/core/v3/address.pb.h"
#include "envoy/config/trace/v3/xray.pb.h"
#include "envoy/config/trace/v3/xray.pb.validate.h"
#include "envoy/registry/registry.h"
#include "common/common/utility.h"
#include "common/config/datasource.h"
#include "common/tracing/http_tracer_impl.h"
#include "extensions/tracers/well_known_names.h"
#include "extensions/tracers/xray/xray_tracer_impl.h"
namespace Envoy {
namespace Extensions {
namespace Tracers {
namespace XRay {
XRayTracerFactory::XRayTracerFactory() : FactoryBase(TracerNames::get().XRay) {}
Tracing::HttpTracerPtr
XRayTracerFactory::createHttpTracerTyped(const envoy::config::trace::v3::XRayConfig& proto_config,
Server::Instance& server) {
std::string sampling_rules_json;
try {
sampling_rules_json =
Config::DataSource::read(proto_config.sampling_rule_manifest(), true, server.api());
} catch (EnvoyException& e) {
ENVOY_LOG(error, "Failed to read sampling rules manifest because of {}.", e.what());
}
if (proto_config.daemon_endpoint().protocol() != envoy::config::core::v3::SocketAddress::UDP) {
throw EnvoyException("X-Ray daemon endpoint must be a UDP socket address");
}
if (proto_config.daemon_endpoint().port_specifier_case() !=
envoy::config::core::v3::SocketAddress::PortSpecifierCase::kPortValue) {
throw EnvoyException("X-Ray daemon port must be specified as number. Not a named port.");
}
const std::string endpoint = fmt::format("{}:{}", proto_config.daemon_endpoint().address(),
proto_config.daemon_endpoint().port_value());
XRayConfiguration xconfig{endpoint, proto_config.segment_name(), sampling_rules_json};
auto xray_driver = std::make_unique<XRay::Driver>(xconfig, server);
return std::make_unique<Tracing::HttpTracerImpl>(std::move(xray_driver), server.localInfo());
}
/**
* Static registration for the XRay tracer. @see RegisterFactory.
*/
REGISTER_FACTORY(XRayTracerFactory, Server::Configuration::TracerFactory);
} // namespace XRay
} // namespace Tracers
} // namespace Extensions
} // namespace Envoy
|
; char *pathnice(char *path)
SECTION code_string
PUBLIC _pathnice
EXTERN asm_pathnice
_pathnice:
pop af
pop hl
push hl
push af
jp asm_pathnice
|
lw $t0, 1000
lw $t1, 1004
sw $t0, 1100
lw $t0, 1104
lw $t0, 1008
|
object_const_def ; object_event constants
const TEAMROCKETBASEB3F_LANCE
const TEAMROCKETBASEB3F_ROCKET1
const TEAMROCKETBASEB3F_MOLTRES
const TEAMROCKETBASEB3F_ROCKET_GIRL
const TEAMROCKETBASEB3F_ROCKET2
const TEAMROCKETBASEB3F_SCIENTIST1
const TEAMROCKETBASEB3F_SCIENTIST2
const TEAMROCKETBASEB3F_ROCKET3
const TEAMROCKETBASEB3F_SILVER
const TEAMROCKETBASEB3F_POKE_BALL1
const TEAMROCKETBASEB3F_POKE_BALL2
const TEAMROCKETBASEB3F_POKE_BALL3
const TEAMROCKETBASEB3F_POKE_BALL4
const TEAMROCKETBASEB3F_POKE_BALL5
TeamRocketBaseB3F_MapScripts:
db 4 ; scene scripts
scene_script .LanceGetsPassword ; SCENE_DEFAULT
scene_script .DummyScene1 ; SCENE_TEAMROCKETBASEB3F_RIVAL_ENCOUNTER
scene_script .DummyScene2 ; SCENE_TEAMROCKETBASEB3F_ROCKET_BOSS
scene_script .DummyScene3 ; SCENE_TEAMROCKETBASEB3F_NOTHING
db 1 ; callbacks
callback MAPCALLBACK_TILES, .CheckGiovanniDoor
.LanceGetsPassword:
prioritysjump LanceGetPasswordScript
end
.DummyScene1:
end
.DummyScene2:
end
.DummyScene3:
end
.CheckGiovanniDoor:
checkevent EVENT_OPENED_DOOR_TO_GIOVANNIS_OFFICE
iftrue .OpenSesame
return
.OpenSesame:
changeblock 10, 8, $07 ; floor
return
LanceGetPasswordScript:
turnobject PLAYER, LEFT
pause 5
turnobject TEAMROCKETBASEB3F_MOLTRES, RIGHT
pause 20
applymovement TEAMROCKETBASEB3F_LANCE, MovementData_0x6e12a
opentext
writetext LanceGetPasswordText
waitbutton
closetext
applymovement TEAMROCKETBASEB3F_LANCE, MovementData_0x6e12c
disappear TEAMROCKETBASEB3F_LANCE
setscene SCENE_TEAMROCKETBASEB3F_RIVAL_ENCOUNTER
end
RocketBaseRival:
turnobject PLAYER, LEFT
showemote EMOTE_SHOCK, PLAYER, 15
special FadeOutMusic
appear TEAMROCKETBASEB3F_SILVER
applymovement TEAMROCKETBASEB3F_SILVER, RocketBaseRivalEnterMovement
turnobject PLAYER, LEFT
playmusic MUSIC_RIVAL_ENCOUNTER
opentext
writetext RocketBaseRivalText
waitbutton
closetext
playsound SFX_TACKLE
applymovement PLAYER, RocketBaseRivalShovesPlayerMovement
applymovement TEAMROCKETBASEB3F_SILVER, RocketBaseRivalLeaveMovement
disappear TEAMROCKETBASEB3F_SILVER
setscene SCENE_TEAMROCKETBASEB3F_ROCKET_BOSS
special RestartMapMusic
end
TeamRocketBaseB3FRocketScript:
jumptextfaceplayer TeamRocketBaseB3FRocketText
RocketBaseBossLeft:
applymovement PLAYER, MovementData_0x6e133
sjump RocketBaseBoss
RocketBaseBossRight:
applymovement PLAYER, MovementData_0x6e13a
RocketBaseBoss:
pause 30
showemote EMOTE_SHOCK, TEAMROCKETBASEB3F_ROCKET1, 15
playmusic MUSIC_ROCKET_ENCOUNTER
turnobject TEAMROCKETBASEB3F_ROCKET1, DOWN
opentext
writetext ExecutiveM4BeforeText
waitbutton
closetext
applymovement TEAMROCKETBASEB3F_ROCKET1, MovementData_0x6e142
winlosstext ExecutiveM4BeatenText, 0
setlasttalked TEAMROCKETBASEB3F_ROCKET1
loadtrainer EXECUTIVEM, EXECUTIVEM_4
startbattle
reloadmapafterbattle
setevent EVENT_BEAT_ROCKET_EXECUTIVEM_4
opentext
writetext ExecutiveM4AfterText
waitbutton
closetext
applymovement TEAMROCKETBASEB3F_ROCKET1, MovementData_0x6e144
playsound SFX_TACKLE
applymovement TEAMROCKETBASEB3F_ROCKET1, MovementData_0x6e147
disappear TEAMROCKETBASEB3F_ROCKET1
setscene SCENE_TEAMROCKETBASEB3F_NOTHING
end
RocketBaseMurkrow:
opentext
writetext RocketBaseMurkrowText
waitbutton
closetext
setevent EVENT_LEARNED_HAIL_GIOVANNI
end
SlowpokeTailGrunt:
trainer GRUNTF, GRUNTF_5, EVENT_BEAT_ROCKET_GRUNTF_5, GruntF5SeenText, GruntF5BeatenText, 0, GruntF5Script
GruntF5Script:
endifjustbattled
opentext
writetext GruntF5AfterBattleText
waitbutton
closetext
setevent EVENT_LEARNED_SLOWPOKETAIL
end
RaticateTailGrunt:
trainer GRUNTM, GRUNTM_28, EVENT_BEAT_ROCKET_GRUNTM_28, GruntM28SeenText, GruntM28BeatenText, 0, GruntM28Script
GruntM28Script:
endifjustbattled
opentext
writetext GruntM28AfterBattleText
waitbutton
closetext
setevent EVENT_LEARNED_RATICATE_TAIL
end
TrainerScientistRoss:
trainer SCIENTIST, ROSS, EVENT_BEAT_SCIENTIST_ROSS, ScientistRossSeenText, ScientistRossBeatenText, 0, .Script
.Script:
endifjustbattled
opentext
writetext ScientistRossAfterBattleText
waitbutton
closetext
end
TrainerScientistMitch:
trainer SCIENTIST, MITCH, EVENT_BEAT_SCIENTIST_MITCH, ScientistMitchSeenText, ScientistMitchBeatenText, 0, .Script
.Script:
endifjustbattled
opentext
writetext ScientistMitchAfterBattleText
waitbutton
closetext
end
TeamRocketBaseB3FLockedDoor:
conditional_event EVENT_OPENED_DOOR_TO_GIOVANNIS_OFFICE, .Script
.Script:
opentext
checkevent EVENT_LEARNED_SLOWPOKETAIL
iffalse .NeedsPassword
checkevent EVENT_LEARNED_RATICATE_TAIL
iffalse .NeedsPassword
sjump .OpenSesame
.NeedsPassword:
writetext TeamRocketBaseB3FLockedDoorNeedsPasswordText
waitbutton
closetext
end
.OpenSesame:
writetext TeamRocketBaseB3FLockedDoorOpenSesameText
waitbutton
playsound SFX_ENTER_DOOR
changeblock 10, 8, $07 ; floor
reloadmappart
closetext
setevent EVENT_OPENED_DOOR_TO_GIOVANNIS_OFFICE
waitsfx
end
TeamRocketBaseB3FOathScript:
jumpstd teamrocketoath
TeamRocketBaseB3FProtein:
itemball PROTEIN
TeamRocketBaseB3FXSpecial:
itemball X_SPECIAL
TeamRocketBaseB3FFullHeal:
itemball FULL_HEAL
TeamRocketBaseB3FIceHeal:
itemball ICE_HEAL
TeamRocketBaseB3FUltraBall:
itemball ULTRA_BALL
MovementData_0x6e12a:
step RIGHT
step_end
MovementData_0x6e12c:
step DOWN
step LEFT
step LEFT
step LEFT
step LEFT
step LEFT
step_end
MovementData_0x6e133:
step UP
step UP
step UP
step LEFT
step LEFT
turn_head UP
step_end
MovementData_0x6e13a:
step UP
step UP
step LEFT
step UP
step LEFT
step LEFT
turn_head UP
step_end
MovementData_0x6e142:
step DOWN
step_end
MovementData_0x6e144:
big_step RIGHT
big_step RIGHT
step_end
MovementData_0x6e147:
fix_facing
fast_jump_step LEFT
remove_fixed_facing
step_sleep 8
step_sleep 8
slow_step RIGHT
big_step DOWN
big_step DOWN
big_step DOWN
big_step RIGHT
big_step DOWN
big_step DOWN
big_step DOWN
big_step LEFT
big_step LEFT
big_step LEFT
big_step LEFT
big_step LEFT
big_step UP
big_step UP
big_step UP
big_step UP
big_step UP
big_step UP
big_step UP
big_step UP
big_step LEFT
big_step LEFT
step_end
RocketBaseRivalEnterMovement:
step DOWN
step DOWN
step DOWN
step DOWN
step DOWN
step RIGHT
step RIGHT
step RIGHT
step_end
RocketBaseRivalLeaveMovement:
step LEFT
step LEFT
step UP
step UP
step UP
step UP
step UP
step_end
RocketBaseRivalShovesPlayerMovement:
fix_facing
big_step RIGHT
remove_fixed_facing
step_end
LanceGetPasswordText:
text "LANCE: It takes"
line "two passwords to"
para "get into the"
line "boss's quarters."
para "Those passwords"
line "are known only to"
cont "a few ROCKETS."
para "That ROCKET there"
line "very graciously"
cont "told me so."
para "<PLAY_G>, let's go"
line "get the passwords."
done
TeamRocketBaseB3FRocketText:
text "Urrggh… The guy"
line "in the cape is"
cont "incredibly tough…"
done
RocketBaseRivalText:
text "…"
para "Didn't I tell you"
line "that I was going"
para "to destroy TEAM"
line "ROCKET?"
para "…Tell me, who was"
line "the guy in the"
para "cape who used"
line "dragon #MON?"
para "My #MON were no"
line "match at all."
para "I don't care that"
line "I lost. I can beat"
para "him by getting"
line "stronger #MON."
para "It's what he said"
line "that bothers me…"
para "He told me that"
line "I don't love and"
para "trust my #MON"
line "enough."
para "I'm furious that I"
line "lost to a bleeding"
cont "heart like him."
para "…Humph! I don't"
line "have the time for"
cont "the likes of you!"
done
ExecutiveM4BeforeText:
text "What? Who are you?"
line "This is the office"
para "of our leader,"
line "GIOVANNI."
para "Since disbanding"
line "TEAM ROCKET three"
para "years ago, he has"
line "been in training."
para "But we're certain"
line "he will be back"
para "some day to assume"
line "command again."
para "That's why we're"
line "standing guard."
para "I won't let any-"
line "one disturb this"
cont "place!"
done
ExecutiveM4BeatenText:
text "I… I couldn't do a"
line "thing…"
para "GIOVANNI, please"
line "forgive me…"
done
ExecutiveM4AfterText:
text "No, I can't let"
line "this affect me."
para "I have to inform"
line "the others…"
done
RocketBaseMurkrowText:
text "MURKROW: The"
line "password is…"
para "HAIL GIOVANNI."
done
GruntF5SeenText:
text "Do I know the"
line "password?"
para "Maybe."
para "But no weakling's"
line "going to get it!"
done
GruntF5BeatenText:
text "All right. Stop."
line "I'll tell you."
done
GruntF5AfterBattleText:
text "The password to"
line "the boss's room is"
para "SLOWPOKETAIL."
para "But it's useless"
line "unless you have"
cont "two passwords."
done
GruntM28SeenText:
text "Hyuck-hyuck-hyuck!"
para "You're challenging"
line "me to a battle?"
para "Hah! You're nuts,"
line "but you have guts!"
para "I like that!"
para "If you can beat"
line "me, I'll tell you"
para "a password to the"
line "boss's room!"
done
GruntM28BeatenText:
text "Hyuck-hyuck-hyuck!"
line "You're good!"
done
GruntM28AfterBattleText:
text "Hyuck-hyuck-hyuck!"
para "The password to"
line "the boss's room…"
para "Uh…, I think it is"
line "RATICATE TAIL."
done
ScientistRossSeenText:
text "I used to work for"
line "SILPH, but now I"
para "run research for"
line "TEAM ROCKET."
para "A meddlesome child"
line "like you needs to"
cont "be punished."
done
ScientistRossBeatenText:
text "A mere tactical"
line "error cost me…"
done
ScientistRossAfterBattleText:
text "A radio signal"
line "that drives #-"
cont "MON mad…"
para "My experiment is a"
line "complete success."
para "My promotion is"
line "assured. This loss"
para "means absolutely"
line "nothing."
done
ScientistMitchSeenText:
text "I don't care that"
line "#MON are hurt"
cont "by our experiment."
done
ScientistMitchBeatenText:
text "Thinking is my"
line "strong suit, not"
cont "battling."
done
ScientistMitchAfterBattleText:
text "If we turn up the"
line "power of our radio"
para "signal for broad-"
line "cast nationwide…"
para "The very thought"
line "excites me!"
done
TeamRocketBaseB3FLockedDoorNeedsPasswordText:
text "The door's closed…"
para "It needs two"
line "passwords to open."
done
TeamRocketBaseB3FLockedDoorOpenSesameText:
text "The door's closed…"
para "<PLAYER> entered"
line "the two passwords."
para "The door opened!"
done
TeamRocketBaseB3F_MapEvents:
db 0, 0 ; filler
db 4 ; warp events
warp_event 3, 2, TEAM_ROCKET_BASE_B2F, 2
warp_event 27, 2, TEAM_ROCKET_BASE_B2F, 3
warp_event 3, 6, TEAM_ROCKET_BASE_B2F, 4
warp_event 27, 14, TEAM_ROCKET_BASE_B2F, 5
db 3 ; coord events
coord_event 10, 8, SCENE_TEAMROCKETBASEB3F_ROCKET_BOSS, RocketBaseBossLeft
coord_event 11, 8, SCENE_TEAMROCKETBASEB3F_ROCKET_BOSS, RocketBaseBossRight
coord_event 8, 10, SCENE_TEAMROCKETBASEB3F_RIVAL_ENCOUNTER, RocketBaseRival
db 10 ; bg events
bg_event 10, 9, BGEVENT_IFNOTSET, TeamRocketBaseB3FLockedDoor
bg_event 11, 9, BGEVENT_IFNOTSET, TeamRocketBaseB3FLockedDoor
bg_event 10, 1, BGEVENT_READ, TeamRocketBaseB3FOathScript
bg_event 11, 1, BGEVENT_READ, TeamRocketBaseB3FOathScript
bg_event 12, 1, BGEVENT_READ, TeamRocketBaseB3FOathScript
bg_event 13, 1, BGEVENT_READ, TeamRocketBaseB3FOathScript
bg_event 4, 13, BGEVENT_READ, TeamRocketBaseB3FOathScript
bg_event 5, 13, BGEVENT_READ, TeamRocketBaseB3FOathScript
bg_event 6, 13, BGEVENT_READ, TeamRocketBaseB3FOathScript
bg_event 7, 13, BGEVENT_READ, TeamRocketBaseB3FOathScript
db 14 ; object events
object_event 25, 14, SPRITE_LANCE, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, LanceGetPasswordScript, EVENT_TEAM_ROCKET_BASE_B3F_LANCE_PASSWORDS
object_event 8, 3, SPRITE_ROCKET, SPRITEMOVEDATA_STANDING_UP, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, ObjectEvent, EVENT_TEAM_ROCKET_BASE_B3F_EXECUTIVE
object_event 7, 2, SPRITE_MOLTRES, SPRITEMOVEDATA_POKEMON, 0, 0, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_SCRIPT, 0, RocketBaseMurkrow, EVENT_TEAM_ROCKET_BASE_POPULATION
object_event 21, 7, SPRITE_ROCKET_GIRL, SPRITEMOVEDATA_STANDING_UP, 0, 0, -1, -1, PAL_NPC_RED, OBJECTTYPE_TRAINER, 0, SlowpokeTailGrunt, EVENT_TEAM_ROCKET_BASE_POPULATION
object_event 5, 14, SPRITE_ROCKET, SPRITEMOVEDATA_SPINRANDOM_FAST, 0, 0, -1, -1, 0, OBJECTTYPE_TRAINER, 3, RaticateTailGrunt, EVENT_TEAM_ROCKET_BASE_POPULATION
object_event 23, 11, SPRITE_SCIENTIST, SPRITEMOVEDATA_STANDING_UP, 0, 0, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_TRAINER, 0, TrainerScientistRoss, EVENT_TEAM_ROCKET_BASE_POPULATION
object_event 11, 15, SPRITE_SCIENTIST, SPRITEMOVEDATA_STANDING_RIGHT, 0, 0, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_TRAINER, 3, TrainerScientistMitch, EVENT_TEAM_ROCKET_BASE_POPULATION
object_event 24, 14, SPRITE_ROCKET, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, TeamRocketBaseB3FRocketScript, EVENT_TEAM_ROCKET_BASE_POPULATION
object_event 4, 5, SPRITE_SILVER, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, ObjectEvent, EVENT_RIVAL_TEAM_ROCKET_BASE
object_event 1, 12, SPRITE_POKE_BALL, SPRITEMOVEDATA_STILL, 0, 0, -1, -1, 0, OBJECTTYPE_ITEMBALL, 0, TeamRocketBaseB3FProtein, EVENT_TEAM_ROCKET_BASE_B3F_PROTEIN
object_event 3, 12, SPRITE_POKE_BALL, SPRITEMOVEDATA_STILL, 0, 0, -1, -1, 0, OBJECTTYPE_ITEMBALL, 0, TeamRocketBaseB3FXSpecial, EVENT_TEAM_ROCKET_BASE_B3F_X_SPECIAL
object_event 28, 9, SPRITE_POKE_BALL, SPRITEMOVEDATA_STILL, 0, 0, -1, -1, 0, OBJECTTYPE_ITEMBALL, 0, TeamRocketBaseB3FFullHeal, EVENT_TEAM_ROCKET_BASE_B3F_FULL_HEAL
object_event 17, 2, SPRITE_POKE_BALL, SPRITEMOVEDATA_STILL, 0, 0, -1, -1, 0, OBJECTTYPE_ITEMBALL, 0, TeamRocketBaseB3FIceHeal, EVENT_TEAM_ROCKET_BASE_B3F_ICE_HEAL
object_event 14, 10, SPRITE_POKE_BALL, SPRITEMOVEDATA_STILL, 0, 0, -1, -1, 0, OBJECTTYPE_ITEMBALL, 0, TeamRocketBaseB3FUltraBall, EVENT_TEAM_ROCKET_BASE_B3F_ULTRA_BALL
|
; Licensed to the .NET Foundation under one or more agreements.
; The .NET Foundation licenses this file to you under the MIT license.
include <AsmMacros.inc>
include <AsmConstants.inc>
extern CallDescrWorkerUnwindFrameChainHandler:proc
;;
;; EXTERN_C void FastCallFinalizeWorker(Object *obj, PCODE funcPtr);
;;
NESTED_ENTRY FastCallFinalizeWorker, _TEXT, CallDescrWorkerUnwindFrameChainHandler
alloc_stack 28h ;; alloc callee scratch and align the stack
END_PROLOGUE
;
; RCX: already contains obj*
; RDX: address of finalizer method to call
;
; !!!!!!!!!
; NOTE: you cannot tail call here because we must have the CallDescrWorkerUnwindFrameChainHandler
; personality routine on the stack.
; !!!!!!!!!
call rdx
xor rax, rax
; epilog
add rsp, 28h
ret
NESTED_END FastCallFinalizeWorker, _TEXT
;;extern "C" void CallDescrWorkerInternal(CallDescrData * pCallDescrData);
NESTED_ENTRY CallDescrWorkerInternal, _TEXT, CallDescrWorkerUnwindFrameChainHandler
push_nonvol_reg rbx ; save nonvolatile registers
push_nonvol_reg rsi ;
push_nonvol_reg rbp ;
set_frame rbp, 0 ; set frame pointer
END_PROLOGUE
mov rbx, rcx ; save pCallDescrData in rbx
mov ecx, dword ptr [rbx + CallDescrData__numStackSlots]
test ecx, 1
jz StackAligned
push rax
StackAligned:
mov rsi, [rbx + CallDescrData__pSrc] ; set source argument list address
lea rsi, [rsi + 8 * rcx]
StackCopyLoop: ; copy the arguments to stack top-down to carefully probe for sufficient stack space
sub rsi, 8
push qword ptr [rsi]
dec ecx
jnz StackCopyLoop
;
; N.B. All four argument registers are loaded regardless of the actual number
; of arguments.
;
mov rax, [rbx + CallDescrData__dwRegTypeMap] ; save the reg (arg) type map
mov rcx, 0[rsp] ; load first four argument registers
movss xmm0, real4 ptr 0[rsp] ;
cmp al, ASM_ELEMENT_TYPE_R8 ;
jnz Arg2 ;
movsd xmm0, real8 ptr 0[rsp] ;
Arg2:
mov rdx, 8[rsp] ;
movss xmm1, real4 ptr 8[rsp] ;
cmp ah, ASM_ELEMENT_TYPE_R8 ;
jnz Arg3 ;
movsd xmm1, real8 ptr 8[rsp] ;
Arg3:
mov r8, 10h[rsp] ;
movss xmm2, real4 ptr 10h[rsp];
shr eax, 16 ;
cmp al, ASM_ELEMENT_TYPE_R8 ;
jnz Arg4 ;
movsd xmm2, real8 ptr 10h[rsp];
Arg4:
mov r9, 18h[rsp] ;
movss xmm3, real4 ptr 18h[rsp];
cmp ah, ASM_ELEMENT_TYPE_R8 ;
jnz DoCall ;
movsd xmm3, real8 ptr 18h[rsp];
DoCall:
call qword ptr [rbx+CallDescrData__pTarget] ; call target function
; Save FP return value
mov ecx, dword ptr [rbx+CallDescrData__fpReturnSize]
test ecx, ecx
jz ReturnsInt
cmp ecx, 4
je ReturnsFloat
cmp ecx, 8
je ReturnsDouble
; unexpected
jmp Epilog
ReturnsInt:
mov [rbx+CallDescrData__returnValue], rax
Epilog:
lea rsp, 0[rbp] ; deallocate argument list
pop rbp ; restore nonvolatile register
pop rsi ;
pop rbx ;
ret
ReturnsFloat:
movss real4 ptr [rbx+CallDescrData__returnValue], xmm0
jmp Epilog
ReturnsDouble:
movsd real8 ptr [rbx+CallDescrData__returnValue], xmm0
jmp Epilog
NESTED_END CallDescrWorkerInternal, _TEXT
end
|
/*
;********************************************************************************************************
; uC/OS-III
; The Real-Time Kernel
;
; Copyright 2009-2021 Silicon Laboratories Inc. www.silabs.com
;
; SPDX-License-Identifier: APACHE-2.0
;
; This software is subject to an open source license and is distributed by
; Silicon Laboratories Inc. pursuant to the terms of the Apache License,
; Version 2.0 available at www.apache.org/licenses/LICENSE-2.0.
;
;********************************************************************************************************
*/
/*
;********************************************************************************************************
;
; Generic Coldfire with EMAC Port for CodeWarrior Compiler
;
; File : os_cpu_i.asm
; Version : V3.08.01
;********************************************************************************************************
*/
/*
;**************************************************************************************************
; MACROS
;**************************************************************************************************
*/
.macro OS_EMAC_SAVE
/* CODE BELOW TO SAVE EMAC REGISTERS */
MOVE.L MACSR,D7 /* Save the MACSR */
CLR.L D0 /* Disable rounding in the MACSR */
MOVE.L D0,MACSR /* Save the accumulators */
MOVE.L ACC0,D0
MOVE.L ACC1,D1
MOVE.L ACC2,D2
MOVE.L ACC3,D3
MOVE.L ACCEXT01,D4 /* Save the accumulator extensions */
MOVE.L ACCEXT23,D5
MOVE.L MASK,D6 /* Save the address mask */
LEA -32(A7),A7 /* Move the EMAC state to the task's stack */
MOVEM.L D0-D7,(A7)
.endm
.macro OS_EMAC_RESTORE
/* CODE BELOW TO RESTORE EMAC REGISTERS */
MOVEM.L (A7),D0-D7 /* Restore the EMAC state */
MOVE.L #0,MACSR /* Disable rounding in the MACSR */
MOVE.L D0,ACC0 /* Restore the accumulators */
MOVE.L D1,ACC1
MOVE.L D2,ACC2
MOVE.L D3,ACC3
MOVE.L D4,ACCEXT01
MOVE.L D5,ACCEXT23
MOVE.L D6,MASK
MOVE.L D7,MACSR
LEA 32(A7),A7
.endm
|
%ifndef EXE_LENGTH
%include "../UltimaPatcher.asm"
%include "include/uw1.asm"
%include "include/uw1-eop.asm"
%endif
[bits 16]
startPatch EXE_LENGTH, \
expanded overlay procedure: flipToPanel
startBlockAt addr_eop_flipToPanel
push bp
mov bp, sp
; bp-based stack frame:
%assign arg_panelNumber 0x04
%assign ____callerIp 0x02
%assign ____callerBp 0x00
push si
push di
; if specified panel is already active, flip to inventory panel instead
mov ax, [bp+arg_panelNumber]
cmp byte [dseg_activePanelNumber], al
jz flipToInventoryPanel
flipToSpecifiedPanel:
push ax
push 6
callFromOverlay setPanelState
add sp, 4
jmp endProc
flipToInventoryPanel:
push 0
push 6
callFromOverlay setPanelState
add sp, 4
endProc:
pop di
pop si
mov sp, bp
pop bp
retn
endBlockAt off_eop_flipToPanel_end
endPatch
|
; FV-1 Testing
;
; Program: Read reg 0x1c
;
; POT0: Test Value
;
; Check read register 0x1c
;
skp RUN,main
wlds SIN0,0x03f,0x7fff ; SIN0
wlds SIN1,0x07f,0x7fff ; SIN1
wldr RMP0,0x2000,4096 ; RMP0
wldr RMP0,0x4000,4096 ; RMP1
main: clr
rdax 0x1c,1.0 ; load reg 0x1c
wrax DACL,0.0 ; write to DACL
cho sof,SIN0,REG|COMPA,0.0 ; "register" SIN0
cho sof,SIN1,REG|COMPA,0.0 ; "register" SIN1
cho sof,RMP0,REG|COMPA,0.0 ; "register" RMP0
cho sof,RMP1,REG|COMPA,0.0 ; "register" RMP1
clr
;or 0x5a5a5a ; load test pattern
ldax POT0 ; load test pattern
wra 0,0.0 ; write to delay
rda 0x7fff,1.0 ; read from end of delay and into LR
wrax REG0,0.0 ; save to temp reg
or -0.5000 ; load garbage value
not ; flip all the bits
ldax 0x1c ; load test reg
rdax REG0,-1.0 ; subtract temp value from rda
skp ZRO,mark
skp 0,space
mark: or 0x7fffff ; mark equal with max val
space: wrax DACR,0.0 ; write to DACR
|
; A304725: a(n) = n^4 + 8*n^3 + 20*n^2 + 16*n + 2.
; 2,47,194,527,1154,2207,3842,6239,9602,14159,20162,27887,37634,49727,64514,82367,103682,128879,158402,192719,232322,277727,329474,388127,454274,528527,611522,703919,806402,919679,1044482,1181567,1331714,1495727,1674434,1868687
add $0,2
pow $0,2
sub $0,2
pow $0,2
sub $0,2
|
%ifdef CONFIG
{
"RegData": {
"RAX": "0x80000000",
"RDX": "0xFFFFFFFF",
"RBX": "0x0000000080000000",
"RCX": "0x00000000ffffffff",
"R13": "0xffffffff80000000",
"R14": "0x0"
},
"MemoryRegions": {
"0x100000000": "4096"
}
}
%endif
mov r15, 0xe0000000
mov rax, 0xFFFFFFFF80000000
mov [r15 + 8 * 0], rax
mov r14, 0
; Expected
mov eax, 0x41424344
mov edx, 0x51525354
; Desired
mov ebx, 0x80000000
mov ecx, 0xFFFFFFFF
; Memory is already Desired and NOT expected
; Finds bug in CAS on AArch64
cmpxchg8b [r15]
; Set r14 to 1 if if the memory location was expected
setz r14b
; edx and eax will now contain the memory's data
; Check memory location to ensure it contains what we want
mov r13, [r15 + 8 * 0]
hlt
|
/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include <ParallaxMappingExampleComponent.h>
#include <Atom/Component/DebugCamera/ArcBallControllerComponent.h>
#include <Atom/RPI.Public/RPISystemInterface.h>
#include <Atom/RPI.Public/Scene.h>
#include <Atom/RPI.Reflect/Asset/AssetUtils.h>
#include <Automation/ScriptableImGui.h>
#include <AzCore/Component/TransformBus.h>
#include <RHI/BasicRHIComponent.h>
namespace AtomSampleViewer
{
static const char* ParallaxEnableName = "parallax.useTexture";
static const char* PdoEnableName = "parallax.pdo";
static const char* ParallaxFactorName = "parallax.factor";
static const char* ParallaxHeightOffsetName = "parallax.offset";
static const char* ParallaxShowClippingName = "parallax.showClipping";
static const char* ParallaxAlgorithmName = "parallax.algorithm";
static const char* ParallaxQualityName = "parallax.quality";
static const char* ParallaxUvIndexName = "parallax.textureMapUv";
static const char* AmbientOcclusionUvIndexName = "occlusion.diffuseTextureMapUv";
static const char* BaseColorUvIndexName = "baseColor.textureMapUv";
static const char* NormalUvIndexName = "normal.textureMapUv";
static const char* RoughnessUvIndexName = "roughness.textureMapUv";
static const char* CenterUVName = "uv.center";
static const char* TileUName = "uv.tileU";
static const char* TileVName = "uv.tileV";
static const char* OffsetUName = "uv.offsetU";
static const char* OffsetVName = "uv.offsetV";
static const char* RotationUVName = "uv.rotateDegrees";
static const char* ScaleUVName = "uv.scale";
// Must align with enum value in StandardPbr.materialtype
static const char* ParallaxAlgorithmList[] =
{
"Basic", "Steep", "POM", "Relief", "ContactRefinement"
};
static const char* ParallaxQualityList[] =
{
"Low", "Medium", "High", "Ultra"
};
static const char* ParallaxUvSetList[] =
{
"UV0", "UV1"
};
void ParallaxMappingExampleComponent::Reflect(AZ::ReflectContext* context)
{
if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class < ParallaxMappingExampleComponent, AZ::Component>()->Version(0);
}
}
ParallaxMappingExampleComponent::ParallaxMappingExampleComponent()
: m_imguiSidebar("@user@/ParallaxMappingExampleComponent/sidebar.xml")
{
}
void ParallaxMappingExampleComponent::Activate()
{
// Asset
m_planeAsset = AZ::RPI::AssetUtils::GetAssetByProductPath<AZ::RPI::ModelAsset>("objects/plane.azmodel", AZ::RPI::AssetUtils::TraceLevel::Assert);
m_boxAsset = AZ::RPI::AssetUtils::GetAssetByProductPath<AZ::RPI::ModelAsset>("objects/cube.azmodel", AZ::RPI::AssetUtils::TraceLevel::Assert);
m_parallaxMaterialAsset = AZ::RPI::AssetUtils::GetAssetByProductPath<AZ::RPI::MaterialAsset>("testdata/materials/parallaxrock.azmaterial", AZ::RPI::AssetUtils::TraceLevel::Assert);
m_defaultMaterialAsset = AZ::RPI::AssetUtils::GetAssetByProductPath<AZ::RPI::MaterialAsset>("materials/defaultpbr.azmaterial", AZ::RPI::AssetUtils::TraceLevel::Assert);
m_parallaxMaterial = AZ::RPI::Material::Create(m_parallaxMaterialAsset);
m_defaultMaterial = AZ::RPI::Material::Create(m_defaultMaterialAsset);
m_planeTransform = AZ::Transform::CreateUniformScale(5);
m_planeHandle = LoadMesh(m_planeAsset, m_parallaxMaterial, m_planeTransform);
m_boxHandle = LoadMesh(m_boxAsset, m_defaultMaterial, AZ::Transform::CreateIdentity());
// Material index
m_parallaxEnableIndex = m_parallaxMaterial->FindPropertyIndex(AZ::Name(ParallaxEnableName));
m_parallaxFactorIndex = m_parallaxMaterial->FindPropertyIndex(AZ::Name(ParallaxFactorName));
m_parallaxOffsetIndex = m_parallaxMaterial->FindPropertyIndex(AZ::Name(ParallaxHeightOffsetName));
m_parallaxShowClippingIndex = m_parallaxMaterial->FindPropertyIndex(AZ::Name(ParallaxShowClippingName));
m_parallaxAlgorithmIndex = m_parallaxMaterial->FindPropertyIndex(AZ::Name(ParallaxAlgorithmName));
m_parallaxQualityIndex = m_parallaxMaterial->FindPropertyIndex(AZ::Name(ParallaxQualityName));
m_parallaxUvIndex = m_parallaxMaterial->FindPropertyIndex(AZ::Name(ParallaxUvIndexName));
m_pdoEnableIndex = m_parallaxMaterial->FindPropertyIndex(AZ::Name(PdoEnableName));
m_ambientOcclusionUvIndex = m_parallaxMaterial->FindPropertyIndex(AZ::Name(AmbientOcclusionUvIndexName));
m_baseColorUvIndex = m_parallaxMaterial->FindPropertyIndex(AZ::Name(BaseColorUvIndexName));
m_normalUvIndex = m_parallaxMaterial->FindPropertyIndex(AZ::Name(NormalUvIndexName));
m_roughnessUvIndex = m_parallaxMaterial->FindPropertyIndex(AZ::Name(RoughnessUvIndexName));
m_centerUVIndex = m_parallaxMaterial->FindPropertyIndex(AZ::Name(CenterUVName));
m_tileUIndex = m_parallaxMaterial->FindPropertyIndex(AZ::Name(TileUName));
m_tileVIndex = m_parallaxMaterial->FindPropertyIndex(AZ::Name(TileVName));
m_offsetUIndex = m_parallaxMaterial->FindPropertyIndex(AZ::Name(OffsetUName));
m_offsetVIndex = m_parallaxMaterial->FindPropertyIndex(AZ::Name(OffsetVName));
m_rotationUVIndex = m_parallaxMaterial->FindPropertyIndex(AZ::Name(RotationUVName));
m_scaleUVIndex = m_parallaxMaterial->FindPropertyIndex(AZ::Name(ScaleUVName));
SaveCameraConfiguration();
// Camera
AZ::Debug::CameraControllerRequestBus::Event(
GetCameraEntityId(),
&AZ::Debug::CameraControllerRequestBus::Events::Enable,
azrtti_typeid<AZ::Debug::ArcBallControllerComponent>());
ConfigureCameraToLookDown();
SetCameraConfiguration();
// Light
m_directionalLightFeatureProcessor = m_scene->GetFeatureProcessor<AZ::Render::DirectionalLightFeatureProcessorInterface>();
CreateDirectionalLight();
m_diskLightFeatureProcessor = m_scene->GetFeatureProcessor<AZ::Render::DiskLightFeatureProcessorInterface>();
CreateDiskLight();
m_imguiSidebar.Activate();
AZ::TickBus::Handler::BusConnect();
}
void ParallaxMappingExampleComponent::Deactivate()
{
GetMeshFeatureProcessor()->ReleaseMesh(m_planeHandle);
GetMeshFeatureProcessor()->ReleaseMesh(m_boxHandle);
RestoreCameraConfiguration();
AZ::Debug::CameraControllerRequestBus::Event(
GetCameraEntityId(),
&AZ::Debug::CameraControllerRequestBus::Events::Disable);
m_directionalLightFeatureProcessor->ReleaseLight(m_directionalLightHandle);
m_diskLightFeatureProcessor->ReleaseLight(m_diskLightHandle);
m_imguiSidebar.Deactivate();
AZ::TickBus::Handler::BusDisconnect();
}
void ParallaxMappingExampleComponent::ConfigureCameraToLookDown()
{
const float CameraDistance = 5.0f;
const float CameraPitch = -0.8f;
AZ::Debug::ArcBallControllerRequestBus::Event(GetCameraEntityId(), &AZ::Debug::ArcBallControllerRequestBus::Events::SetPitch, CameraPitch);
AZ::Debug::ArcBallControllerRequestBus::Event(GetCameraEntityId(), &AZ::Debug::ArcBallControllerRequestBus::Events::SetDistance, CameraDistance);
}
AZ::Render::MeshFeatureProcessorInterface::MeshHandle ParallaxMappingExampleComponent::LoadMesh(
AZ::Data::Asset<AZ::RPI::ModelAsset> modelAsset,
AZ::Data::Instance<AZ::RPI::Material> material,
AZ::Transform transform)
{
AZ::Render::MeshFeatureProcessorInterface::MeshHandle meshHandle = GetMeshFeatureProcessor()->AcquireMesh(AZ::Render::MeshHandleDescriptor{ modelAsset }, material);
GetMeshFeatureProcessor()->SetTransform(meshHandle, transform);
return meshHandle;
}
void ParallaxMappingExampleComponent::CreateDirectionalLight()
{
const AZ::Render::DirectionalLightFeatureProcessorInterface::LightHandle handle = m_directionalLightFeatureProcessor->AcquireLight();
m_directionalLightFeatureProcessor->SetShadowmapSize(handle, AZ::Render::ShadowmapSize::Size2048);
m_directionalLightFeatureProcessor->SetCascadeCount(handle, 4);
m_directionalLightFeatureProcessor->SetShadowmapFrustumSplitSchemeRatio(handle, 0.5f);
m_directionalLightFeatureProcessor->SetViewFrustumCorrectionEnabled(handle, true);
m_directionalLightFeatureProcessor->SetShadowFilterMethod(handle, AZ::Render::ShadowFilterMethod::Esm);
m_directionalLightFeatureProcessor->SetFilteringSampleCount(handle, 32);
m_directionalLightFeatureProcessor->SetGroundHeight(handle, 0.f);
m_directionalLightHandle = handle;
}
void ParallaxMappingExampleComponent::CreateDiskLight()
{
AZ::Render::DiskLightFeatureProcessorInterface* const featureProcessor = m_diskLightFeatureProcessor;
const AZ::Render::DiskLightFeatureProcessorInterface::LightHandle handle = featureProcessor->AcquireLight();
featureProcessor->SetAttenuationRadius(handle, sqrtf(500.f / CutoffIntensity));
featureProcessor->SetConeAngles(handle, AZ::DegToRad(22.5f) * ConeAngleInnerRatio, AZ::DegToRad(22.5f));
featureProcessor->SetShadowsEnabled(handle, true);
featureProcessor->SetShadowmapMaxResolution(handle, AZ::Render::ShadowmapSize::Size2048);
m_diskLightHandle = handle;
}
void ParallaxMappingExampleComponent::OnTick(float deltaTime, [[maybe_unused]] AZ::ScriptTimePoint time)
{
if (m_lightAutoRotate)
{
m_lightRotationAngle = fmodf(m_lightRotationAngle + deltaTime, AZ::Constants::TwoPi);
}
const auto location = AZ::Vector3(
5 * sinf(m_lightRotationAngle),
5 * cosf(m_lightRotationAngle),
5);
auto transform = AZ::Transform::CreateLookAt(
location,
AZ::Vector3::CreateZero());
using Lux = AZ::Render::PhotometricColor<AZ::Render::PhotometricUnit::Lux>;
using Candela = AZ::Render::PhotometricColor<AZ::Render::PhotometricUnit::Candela>;
Lux directionalLightColor{AZ::Color::CreateZero()};
Candela diskLightColor{AZ::Color::CreateZero()};
switch (static_cast<LightSelection>(m_lightType))
{
case LightSelection::Directional:
directionalLightColor = Lux{AZ::Color::CreateOne() * 5.f};
break;
case LightSelection::Spot:
diskLightColor = Candela{AZ::Color::CreateOne() * 500.f};
break;
case LightSelection::None:
// Keep initial 0 values
break;
default:
AZ_Assert(false, "Unhandled case");
break;
}
m_diskLightFeatureProcessor->SetRgbIntensity(m_diskLightHandle, diskLightColor);
m_diskLightFeatureProcessor->SetPosition(m_diskLightHandle, location);
m_diskLightFeatureProcessor->SetDirection(m_diskLightHandle, transform.GetBasis(1));
m_directionalLightFeatureProcessor->SetRgbIntensity(m_directionalLightHandle, directionalLightColor);
m_directionalLightFeatureProcessor->SetDirection(m_directionalLightHandle, transform.GetBasis(1));
// Camera Configuration
{
Camera::Configuration config;
Camera::CameraRequestBus::EventResult(
config,
GetCameraEntityId(),
&Camera::CameraRequestBus::Events::GetCameraConfiguration);
m_directionalLightFeatureProcessor->SetCameraConfiguration(
m_directionalLightHandle,
config);
}
// Camera Transform
{
transform = AZ::Transform::CreateIdentity();
AZ::TransformBus::EventResult(
transform,
GetCameraEntityId(),
&AZ::TransformBus::Events::GetWorldTM);
m_directionalLightFeatureProcessor->SetCameraTransform(
m_directionalLightHandle, transform);
}
// Plane Transform
{
m_planeTransform.SetRotation(AZ::Quaternion::CreateRotationZ(m_planeRotationAngle));
GetMeshFeatureProcessor()->SetTransform(m_planeHandle, m_planeTransform);
}
DrawSidebar();
}
void ParallaxMappingExampleComponent::SetCameraConfiguration()
{
Camera::CameraRequestBus::Event(
GetCameraEntityId(),
&Camera::CameraRequestBus::Events::SetFarClipDistance,
20.f);
Camera::CameraRequestBus::Event(
GetCameraEntityId(),
&Camera::CameraRequestBus::Events::SetFovRadians,
AZ::Constants::QuarterPi);
}
void ParallaxMappingExampleComponent::SaveCameraConfiguration()
{
Camera::CameraRequestBus::EventResult(
m_originalFarClipDistance,
GetCameraEntityId(),
&Camera::CameraRequestBus::Events::GetFarClipDistance);
Camera::CameraRequestBus::EventResult(
m_originalCameraFovRadians,
GetCameraEntityId(),
&Camera::CameraRequestBus::Events::GetFovRadians);
}
void ParallaxMappingExampleComponent::RestoreCameraConfiguration()
{
Camera::CameraRequestBus::Event(
GetCameraEntityId(),
&Camera::CameraRequestBus::Events::SetFarClipDistance,
m_originalFarClipDistance);
Camera::CameraRequestBus::Event(
GetCameraEntityId(),
&Camera::CameraRequestBus::Events::SetFovRadians,
m_originalCameraFovRadians);
}
void ParallaxMappingExampleComponent::DrawSidebar()
{
if (m_imguiSidebar.Begin())
{
bool parallaxSettingChanged = false;
bool planeUVChanged = false;
ImGui::Spacing();
{
ScriptableImGui::ScopedNameContext context{ "Lighting" };
ImGui::Text("Lighting");
ImGui::Indent();
{
ScriptableImGui::RadioButton("No Light", &m_lightType, 0);
ScriptableImGui::RadioButton("Directional Light", &m_lightType, 1);
ScriptableImGui::RadioButton("Spot Light", &m_lightType, 2);
ScriptableImGui::Checkbox("Auto Rotation", &m_lightAutoRotate);
ScriptableImGui::SliderAngle("Direction", &m_lightRotationAngle, 0, 360);
}
ImGui::Unindent();
}
ImGui::Separator();
{
ScriptableImGui::ScopedNameContext context{ "Parallax Setting" };
ImGui::Text("Parallax Setting");
ImGui::Indent();
{
if (ScriptableImGui::Checkbox("Enable Parallax", &m_parallaxEnable))
{
parallaxSettingChanged = true;
m_parallaxMaterial->SetPropertyValue(m_parallaxEnableIndex, m_parallaxEnable);
}
if (m_parallaxEnable)
{
if (ScriptableImGui::Checkbox("Enable Pdo", &m_pdoEnable))
{
parallaxSettingChanged = true;
m_parallaxMaterial->SetPropertyValue(m_pdoEnableIndex, m_pdoEnable);
}
if (ScriptableImGui::SliderFloat("Heightmap Scale", &m_parallaxFactor, 0.0f, 0.1f))
{
parallaxSettingChanged = true;
m_parallaxMaterial->SetPropertyValue(m_parallaxFactorIndex, m_parallaxFactor);
}
if (ScriptableImGui::SliderFloat("Offset", &m_parallaxOffset, -0.1f, 0.1f))
{
parallaxSettingChanged = true;
m_parallaxMaterial->SetPropertyValue(m_parallaxOffsetIndex, m_parallaxOffset);
}
if (ScriptableImGui::Checkbox("Show Clipping", &m_parallaxShowClipping))
{
parallaxSettingChanged = true;
m_parallaxMaterial->SetPropertyValue(m_parallaxShowClippingIndex, m_parallaxShowClipping);
}
if (ScriptableImGui::Combo("Algorithm", &m_parallaxAlgorithm, ParallaxAlgorithmList, AZ_ARRAY_SIZE(ParallaxAlgorithmList)))
{
parallaxSettingChanged = true;
m_parallaxMaterial->SetPropertyValue(m_parallaxAlgorithmIndex, static_cast<uint32_t>(m_parallaxAlgorithm));
}
if (ScriptableImGui::Combo("Quality", &m_parallaxQuality, ParallaxQualityList, AZ_ARRAY_SIZE(ParallaxQualityList)))
{
parallaxSettingChanged = true;
m_parallaxMaterial->SetPropertyValue(m_parallaxQualityIndex, static_cast<uint32_t>(m_parallaxQuality));
}
if (ScriptableImGui::Combo("UV", &m_parallaxUv, ParallaxUvSetList, AZ_ARRAY_SIZE(ParallaxUvSetList)))
{
parallaxSettingChanged = true;
m_parallaxMaterial->SetPropertyValue(m_parallaxUvIndex, static_cast<uint32_t>(m_parallaxUv));
m_parallaxMaterial->SetPropertyValue(m_ambientOcclusionUvIndex, static_cast<uint32_t>(m_parallaxUv));
m_parallaxMaterial->SetPropertyValue(m_baseColorUvIndex, static_cast<uint32_t>(m_parallaxUv));
m_parallaxMaterial->SetPropertyValue(m_normalUvIndex, static_cast<uint32_t>(m_parallaxUv));
m_parallaxMaterial->SetPropertyValue(m_roughnessUvIndex, static_cast<uint32_t>(m_parallaxUv));
}
}
}
ImGui::Unindent();
}
ImGui::Separator();
{
ScriptableImGui::ScopedNameContext context{ "Plane Setting" };
ImGui::Text("Plane Setting");
ImGui::Indent();
{
ScriptableImGui::SliderAngle("Rotation", &m_planeRotationAngle, 0, 360);
bool centerUChanged = false;
bool centerVChanged = false;
bool tileUChanged = false;
bool tileVChanged = false;
bool offsetUChanged = false;
bool offsetVChanged = false;
bool rotationUVChanged = false;
bool scaleChanged = false;
centerUChanged = ScriptableImGui::SliderFloat("Center U", &m_planeCenterU, -1.f, 1.f);
centerVChanged = ScriptableImGui::SliderFloat("Center V", &m_planeCenterV, -1.f, 1.f);
if (centerUChanged || centerVChanged)
{
m_parallaxMaterial->SetPropertyValue(m_centerUVIndex, AZ::Vector2(m_planeCenterU, m_planeCenterV));
}
tileUChanged = ScriptableImGui::SliderFloat("Tile U", &m_planeTileU, 0.f, 2.f);
if (tileUChanged)
{
m_parallaxMaterial->SetPropertyValue(m_tileUIndex, m_planeTileU);
}
tileVChanged = ScriptableImGui::SliderFloat("Tile V", &m_planeTileV, 0.f, 2.f);
if (tileVChanged)
{
m_parallaxMaterial->SetPropertyValue(m_tileVIndex, m_planeTileV);
}
offsetUChanged = ScriptableImGui::SliderFloat("Offset U", &m_planeOffsetU, -1.f, 1.f);
if (offsetUChanged)
{
m_parallaxMaterial->SetPropertyValue(m_offsetUIndex, m_planeOffsetU);
}
offsetVChanged = ScriptableImGui::SliderFloat("Offset V", &m_planeOffsetV, -1.f, 1.f);
if (offsetVChanged)
{
m_parallaxMaterial->SetPropertyValue(m_offsetVIndex, m_planeOffsetV);
}
rotationUVChanged = ScriptableImGui::SliderFloat("Rotation UV", &m_planeRotateUV, -180.f, 180.f);
if (rotationUVChanged)
{
m_parallaxMaterial->SetPropertyValue(m_rotationUVIndex, m_planeRotateUV);
}
scaleChanged = ScriptableImGui::SliderFloat("Scale UV", &m_planeScaleUV, 0.f, 2.f);
if (scaleChanged)
{
m_parallaxMaterial->SetPropertyValue(m_scaleUVIndex, m_planeScaleUV);
}
planeUVChanged = centerUChanged || centerVChanged || tileUChanged || tileVChanged || offsetUChanged || offsetVChanged || rotationUVChanged || scaleChanged;
}
ImGui::Unindent();
}
m_imguiSidebar.End();
if (parallaxSettingChanged || planeUVChanged)
{
m_parallaxMaterial->Compile();
}
}
}
}
|
/*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "TaskbarWindow.h"
#include <LibGUI/GApplication.h>
#include <signal.h>
#include <stdio.h>
#include <sys/wait.h>
int main(int argc, char** argv)
{
if (pledge("stdio shared_buffer accept proc exec rpath unix cpath fattr", nullptr) < 0) {
perror("pledge");
return 1;
}
GUI::Application app(argc, argv);
if (pledge("stdio shared_buffer accept proc exec rpath", nullptr) < 0) {
perror("pledge");
return 1;
}
TaskbarWindow window;
window.show();
signal(SIGCHLD, [](int signo) {
(void)signo;
wait(nullptr);
});
return app.exec();
}
|
SFX_Intro_Whoosh_Ch8:
noise_note 4, 2, -4, 32
noise_note 3, 10, 0, 32
noise_note 3, 11, 0, 33
noise_note 3, 12, 0, 34
noise_note 15, 13, 2, 36
sound_ret
|
;
; This file is automatically generated
;
; Do not edit!!!
;
; djm 12/2/2000
;
; ZSock Lib function: getdomainname
PUBLIC getdomainname
EXTERN no_zsock
INCLUDE "packages.def"
INCLUDE "zsock.def"
.getdomainname
ld a,r_getdomainname
call_pkg(tcp_all)
ret nc
; We failed..are we installed?
cp rc_pnf
scf ;signal error
ret nz ;Internal error
call_pkg(tcp_ayt)
jr nc,getdomainname
jp no_zsock
|
; *******************************************************************************************
; *******************************************************************************************
;
; Name : core.asm
; Purpose : Basic Main Core
; Date : 19th August 2019
; Review : 1st September 2019
; Author : Paul Robson (paul@robsons.org.uk)
;
; *******************************************************************************************
; *******************************************************************************************
.include "../basic/header/header.src"
BASIC_Start:
#ResetStack
jsr IF_Reset ; set up and clear screen.
jsr IFT_ClearScreen
;
.if cpu=="65816"
lda #$5C ; JMP Long opcode
.else
lda #$4C ; JMP opcode
.endif
sta LocalVector
sta UserVector
lda #USRDefault & $FF ; reset USR vector to a default
sta UserVector+1 ; 24 / 16 bit address
lda #(USRDefault >> 8) & $FF ; e.g. it becomes JMP USRDefault
sta UserVector+2
lda #(USRDefault >> 16) & $FF
sta UserVector+3
;
jsr UpdateProgramEnd ; update the program end.
;
jsr ResetRunStatus ; clear everything (CLR command)
;
#ResetStack
.if loadTest!=0
.if loadRun!=0
jmp COMMAND_Run
.else
jmp WarmStart
.endif
.endif
;
jsr Command_NEW ; new command, will not return.
WarmStart:
ldx #ReadyMsg & $FF ; Print READY.
ldy #(ReadyMsg >> 8) & $FF
jsr PrintROMMessage
ErrorStart:
#ResetStack
jsr IFT_ReadLine ; read line in.
;
lda #IFT_LineBuffer & $FF ; tokenise it.
ldx #IFT_LineBuffer >> 8
jsr TokeniseString
;
lda TokeniseBuffer+3 ; what is first.
and #$C0 ; is it a number 4000-7FFF
cmp #$40
beq EditLine ; if true, go to edit line (delete/insert)
#s_toStart TokeniseBuffer ; reset pointer to token buffer.
jmp RUN_NextCommand
ReadyMsg:
.text "Ready.",13,0
EditLine:
jmp EditCode |
/*
* Copyright (C) 2005-2013 Team XBMC
* http://xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XBMC; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*
*/
#include "Bookmark.h"
CBookmark::CBookmark()
{
Reset();
}
void CBookmark::Reset()
{
episodeNumber = 0;
seasonNumber = 0;
timeInSeconds = 0.0f;
totalTimeInSeconds = 0.0f;
partNumber = 0;
type = STANDARD;
}
bool CBookmark::IsSet() const
{
return totalTimeInSeconds > 0.0f;
}
bool CBookmark::IsPartWay() const
{
return totalTimeInSeconds > 0.0f && timeInSeconds > 0.0f;
}
|
object_const_def ; object_event constants
const OREBURGHGYM_ROARK
const OREBURGHGYM_YOUNGSTER1
const OREBURGHGYM_YOUNGSTER2
const OREBURGHGYM_GYM_GUY
OreburghGym_MapScripts:
db 2 ; scene scripts
scene_script .Dummy ; SCENE_DEFAULT
scene_script .Dummy ; SCENE_FINISHED
db 0 ; callbacks
.Dummy:
end
OreburghGym_BridgeOn:
callasm .Bridge
setscene SCENE_FINISHED
end
.Bridge:
changebridgeblock 2, 12, $2c, OREBURGH_GYM
changebridgeblock 4, 12, $2d, OREBURGH_GYM
changebridgeblock 6, 12, $2e, OREBURGH_GYM
bridgeon
OreburghGym_BridgeOff:
callasm .Bridge
setscene SCENE_DEFAULT
end
.Bridge:
changebridgeblock 2, 12, $0c, OREBURGH_GYM
changebridgeblock 4, 12, $0d, OREBURGH_GYM
changebridgeblock 6, 12, $0e, OREBURGH_GYM
bridgeoff
OreburghGym_RoarkScript:
faceplayer
opentext
checkevent EVENT_BEAT_LEADER_ROARK1
iftrue .FightDone
writetext .IntroText
waitbutton
closetext
winlosstext .WinText, 0
loadtrainer ROARK, ROARK1
startbattle
reloadmapafterbattle
setevent EVENT_BEAT_LEADER_ROARK1
opentext
writetext .AfterText
buttonsound
writetext .GotBadgeText
playsound SFX_GET_BADGE
waitsfx
setflag ENGINE_COALBADGE
; after gym events
setevent EVENT_BEAT_YOUNGSTER_JONATHON
setevent EVENT_BEAT_YOUNGSTER_DARIUS
setmapscene OREBURGH_CITY, SCENE_OREBURGHCITY_AFTER_GYM
blackoutmod OREBURGH_CITY
setevent EVENT_GALACTIC_IN_JUBILIFE
clearevent EVENT_JUBILIFE_CITY_DAWNLUCAS
setmapscene JUBILIFE_CITY, SCENE_JUBILIFECITY_CANT_LEAVE_GALACTIC
variablesprite SPRITE_CLOWN_GALACTIC, SPRITE_GALACTIC_M
variablesprite SPRITE_CLOWN_ROWAN, SPRITE_ROWAN
variablesprite SPRITE_DAWN_LUCAS2, SPRITE_DAWN
checkflag ENGINE_PLAYER_IS_FEMALE
iffalse .FightDone
variablesprite SPRITE_DAWN_LUCAS2, SPRITE_LUCAS
.FightDone:
checkevent EVENT_GOT_TM_STEALTH_ROCK
iftrue .AfterTM
writetext .BadgeText
buttonsound
verbosegivetmhm TM_STEALTH_ROCK
iffalse .BagFull
setevent EVENT_GOT_TM_STEALTH_ROCK
writetext .TMText
waitbutton
.BagFull:
closetext
end
.AfterTM:
writetext .AllDoneText
waitbutton
closetext
end
.IntroText:
text "Welcome! This is"
line "the OREBURGH"
cont "#MON GYM!"
para "I'm ROARK, the"
line "GYM LEADER!"
para "I'm but one TRAINER"
line "who decided to"
cont "walk proudly with"
cont "ROCK type #MON!"
para "As the GYM LEADER,"
line "I need to see your"
cont "potential as a"
cont "TRAINER."
para "And, I'll need to"
line "see the toughness"
cont "of the #MON"
cont "that battle with"
cont "you!"
done
.WinText:
text "W-what? That can't"
line "be!"
para "My buffed-up"
line "#MON!"
done
.AfterText:
text "This is"
line "embarrassing…"
para "I went and lost to"
line "a TRAINER who"
cont "didn't have a"
cont "single GYM BADGE…"
para "But that's tough."
para "You were strong,"
line "and I was weak."
para "That's all there is"
line "to it."
para "According to the"
line "#MON LEAGUE"
cont "rules, I have to"
cont "give you our GYM"
cont "BADGE since you've"
cont "beaten me, the"
cont "LEADER."
para "Here's your"
line "official #MON"
cont "LEAGUE COAL BADGE."
done
.GotBadgeText:
text "<PLAYER> receieved"
line "the COAL BADGE!"
done
.BadgeText:
text "Having that COAL"
line "BADGE means your"
cont "#MON can now"
cont "use the hidden"
cont "move ROCK SMASH"
cont "outside of battle."
para "You should also"
line "take this, too."
done
.TMText:
text "That TM76 contains"
line "STEALTH ROCK."
para "It's a move that"
line "inflicts damage on"
cont "foes that switch"
cont "into battle."
para "Incidentally, a TM"
line "will teach its"
cont "move to a #MON"
cont "instantly."
para "But a TM will"
line "break when you use"
cont "it, so make sure"
cont "you want a #MON"
cont "to learn that"
cont "move."
done
.AllDoneText:
text "In this region of"
line "SINNOH, there are"
cont "seven other"
cont "GYM LEADERS."
para "I should warn you:"
line "they're a lot"
cont "tougher than I am!"
done
OreburghGym_GymGuyScript:
faceplayer
checkflag ENGINE_COALBADGE
iftrue .After
jumptext .BeforeText
.After:
jumptext .AfterText
.BeforeText:
text "Howdy! How's it"
line "going, Champ in"
cont "the making?"
para "That's what I said"
line "to a really"
cont "impatient boy"
cont "earlier, too."
para "The GYM LEADER is"
line "a user of ROCK"
cont "type #MON."
para "Well, listne. ROCK"
line "type #MON haye"
cont "water, all right?"
para "They're also weak"
line "to GRASS type"
cont "moves."
para "Gee, they sure"
line "have weaknesses!"
para "But don't think it"
line "will be easy."
para "You don't get to be"
line "a GYM LEADER"
cont "without covering"
cont "for weaknesses."
para "Going after a ROCK"
line "type #MON with"
cont "a FIRE type"
cont "#MON won't be"
cont "easy, either."
para "That's all the"
line "advice I can give."
para "Thanks for"
line "listening!"
done
.AfterText:
text "Oh! <PLAYER>! You've"
line "taken care of the"
cont "GYM LEADER!"
para "So, did my advice"
line "come in handy, or"
cont "what?"
para "If my advice was"
line "useful, it'd be"
cont "great if you'd"
cont "become my fan!"
done
OreburghGym_StatueScript:
gettrainername STRING_BUFFER_4, ROARK, ROARK1
checkflag ENGINE_COALBADGE
iftrue .After
jumpstd gymstatue1
.After:
jumpstd gymstatue2
TrainerYoungsterJonathon:
trainer YOUNGSTER, JONATHON, EVENT_BEAT_YOUNGSTER_JONATHON, .SeenText, .BeatenText, 0, .Script
.Script:
endifjustbattled
opentext
writetext .AfterText
waitbutton
closetext
end
.SeenText:
text "You avoided the"
line "long way around?"
para "Let's see why you'd"
line "do that!"
done
.BeatenText:
text "Now I understand"
line "why you decided to"
cont "battle with me."
done
.AfterText:
text "You should go"
line "whichever way you"
cont "want, shortcut or"
cont "the long way!"
done
TrainerYoungsterDarius:
trainer YOUNGSTER, DARIUS, EVENT_BEAT_YOUNGSTER_DARIUS, .SeenText, .BeatenText, 0, .Script
.Script:
endifjustbattled
opentext
writetext .AfterText
waitbutton
closetext
end
.SeenText:
text "Only those who"
line "want to win can"
cont "challenge a"
cont "#MON GYM!"
done
.BeatenText:
text "Gggh… This is"
line "humiliating!"
done
.AfterText:
text "One day, I'm going"
line "to become a tough"
cont "TRAINER like you."
done
OreburghGym_MapEvents:
db 0, 0 ; filler
db 2 ; warp events
warp_event 4, 19, OREBURGH_CITY, 14
warp_event 5, 19, OREBURGH_CITY, 14
db 8 ; coord events
coord_event 1, 14, SCENE_DEFAULT, OreburghGym_BridgeOn
coord_event 7, 10, SCENE_DEFAULT, OreburghGym_BridgeOn
coord_event 8, 10, SCENE_DEFAULT, OreburghGym_BridgeOn
coord_event 9, 10, SCENE_DEFAULT, OreburghGym_BridgeOn
coord_event 1, 15, SCENE_FINISHED, OreburghGym_BridgeOff
coord_event 7, 9, SCENE_FINISHED, OreburghGym_BridgeOff
coord_event 8, 9, SCENE_FINISHED, OreburghGym_BridgeOff
coord_event 9, 9, SCENE_FINISHED, OreburghGym_BridgeOff
db 2 ; bg events
bg_event 3, 18, BGEVENT_READ, OreburghGym_StatueScript
bg_event 6, 18, BGEVENT_READ, OreburghGym_StatueScript
db 4 ; object events
object_event 4, 1, SPRITE_ROARK, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, OreburghGym_RoarkScript, -1
object_event 3, 14, SPRITE_YOUNGSTER, SPRITEMOVEDATA_STANDING_RIGHT, 0, 0, -1, -1, 0, OBJECTTYPE_TRAINER, 3, TrainerYoungsterJonathon, -1
object_event 6, 7, SPRITE_YOUNGSTER, SPRITEMOVEDATA_STANDING_LEFT, 0, 0, -1, -1, 0, OBJECTTYPE_TRAINER, 4, TrainerYoungsterDarius, -1
object_event 7, 18, SPRITE_GYM_GUY, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, OreburghGym_GymGuyScript, -1
|
; A017190: a(n) = (9*n + 2)^6.
; 64,1771561,64000000,594823321,3010936384,10779215329,30840979456,75418890625,164206490176,326940373369,606355001344,1061520150601,1771561000000,2839760855281,4398046511104,6611856250609,9685390482496,13867245015625,19456426971136,26808753332089,36343632130624,48551226272641,64000000000000,83344647990241,107334407093824,136821750708889,172771465793536,216270112515625,268535866540096,330928743953809,404961208827904,492309163417681,594823321000000,714540961348201,853698068844544,1014741853230169,1200343652992576,1413412221390625,1657107395117056,1934854145598529,2250357012933184,2607614922465721,3010936384000000,3464955073649161,3974645798323264,4545340842854449,5182746699759616,5892961181640625,6682490916222016,7558269224026249,8527674378686464,9598548249896761,10779215329000000,12078502137213121,13505757016489984,15070870303021729,16784294883374656,18657067133265625,20700828238974976,22927845901396969,25351036422727744,27983987175790801,30840979456000000,33937011715960081,37287823182704704,40909917857572009,44820588898717696,49037943386265625,53580927470095936,58469351900270689,63723917940097024,69366243661827841,75418890625000000,81905390937410041,88850274698727424,96279097826745289,104218470266268736,112696084580640625,121740744925904896,131382396407607409,141652154820234304,152582336769287881,164206490176000000,176559425164683001,189677245332718144,203597379403181569,218358613260107776,234001122366390625,250566504564321856,268097813258767129,286639590982979584,306237903347050921,326940373369000000,348796216188498961,371856274163236864,396173052347920849,421800754355914816,448795318603515625,477214454936866816,507117681641509849
mul $0,9
add $0,2
pow $0,6
|
; this file should NOT be assembled by the CI script, it should be on the ignore list
some-invalid-instruction a,123
|
; Scroll Spectrum/TS2068 up
;
; Relies on ROM routines to perform the scroll
;
; Toggle on __zx_screenmode to determine whether to scroll
; the second display
;
MODULE generic_console_scrollup
SECTION code_clib
PUBLIC generic_console_scrollup
EXTERN call_rom3
EXTERN __zx_screenmode
EXTERN __zx_console_attr
EXTERN zx_rowtab
EXTERN generic_console_zxn_tile_scrollup
generic_console_scrollup:
IF FORzxn
ld a,(__zx_screenmode)
bit 6,a
jp nz,generic_console_zxn_tile_scrollup
ENDIF
push de
push bc
IF NOROMCALLS
; Code to be used when the original ROM is missing or not available
push ix
ld ix,zx_rowtab
ld a,8
.outer_loop
push af
push ix
ld a,23
.inner_loop
ld e,(ix+16)
ld d,(ix+17)
ex de,hl
ld e,(ix+0)
ld d,(ix+1)
ld bc,32
ldir
ld bc,16
add ix,bc
dec a
jr nz,inner_loop
pop ix
pop af
inc ix
inc ix
dec a
jr nz,outer_loop
; clear
ld ix,zx_rowtab + (192 - 8) * 2
ld a,8
.clear_loop
push ix
ld e,(ix+0)
ld d,(ix+1)
ld h,d
ld l,e
ld (hl),0
inc de
ld bc,31
ldir
pop ix
inc ix
inc ix
dec a
jr nz,clear_loop
ld hl,$4000+6880
ld de,$4000+6881
ld bc,31
ld a,(__zx_console_attr)
ld (hl),a
ldir
pop ix
pop bc
pop de
ret
ELSE
IF FORts2068 | FORzxn
ld a,(__zx_screenmode)
cp 6 ;Hires
jr z,hrgscroll
cp 2 ;High colour
jr z,hrgscroll
cp 1 ;Screen 1
jr z,hrgscroll
ENDIF
ld a,($dff)
cp $17
jr nz,ts2068_rom
call call_rom3
defw 3582 ;scrollup
pop bc
pop de
ret
.ts2068_rom
call call_rom3
defw $939 ; TS2068 scrollup
pop bc
pop de
ret
ENDIF
IF FORts2068 | FORzxn
.hrgscroll
push ix
ld ix,zx_rowtab
ld a,8
.outer_loophr
push af
push ix
ld a,(__zx_screenmode)
ld b,23
.inner_loophr
push bc
ld e,(ix+16)
ld d,(ix+17)
ex de,hl
ld e,(ix+0)
ld d,(ix+1)
cp 1
jr z,just_screen_1
push de
push hl
ld bc,32
ldir
pop hl
pop de
just_screen_1:
set 5,d
set 5,h
ld bc,32
ldir
ld bc,16
add ix,bc
pop bc
djnz inner_loophr
pop ix
pop af
inc ix
inc ix
dec a
jr nz,outer_loophr
; clear
ld ix,zx_rowtab + (192 - 8) * 2
ld a,(__zx_screenmode)
ld b,8
.clear_loophr
push bc
push ix
ld e,(ix+0)
ld d,(ix+1)
ld h,d
ld l,e
inc de
push de
push hl
cp 1
jr z,clear_screen1_only
ld (hl),0
ld bc,31
ldir
; second display
clear_screen1_only:
pop hl
pop de
set 5,d
set 5,h
cp 4
ex af,af
ld a,(__zx_console_attr)
ld c,a
ex af,af
jr z,clear_hires2
ld c,0
clear_hires2:
ld (hl),c
ld bc,31
ldir
pop ix
inc ix
inc ix
pop bc
djnz clear_loophr
pop ix
pop bc
pop de
ret
ENDIF
|
// This file is part of www.nand2tetris.org
// and the book "The Elements of Computing Systems"
// by Nisan and Schocken, MIT Press.
// File name: projects/04/Fill.asm
// Runs an infinite loop that listens to the keyboard input.
// When a key is pressed (any key), the program blackens the screen,
// i.e. writes "black" in every pixel;
// the screen should remain fully black as long as the key is pressed.
// When no key is pressed, the program clears the screen, i.e. writes
// "white" in every pixel;
// the screen should remain fully clear as long as no key is pressed.
(WAIT_KEY_PRESS)
@KBD
D=M
@WAIT_KEY_PRESS
D;JEQ // if key == 0 goto WAIT_KEY_PRESS
@fill_value
M=-1 // fill = -1
@FILL_START
0;JMP
(WAIT_KEY_RELEASE)
@KBD
D=M
@WAIT_KEY_RELEASE
D;JNE // if key != 0 goto WAIT_KEY_RELEASE
@fill_value
M=0 // fill_value = 0
@FILL_START
0;JMP
(FILL_START)
@8192
D=A
@i
M=D // i = 8192 (512 width x 256 height / 16-bits)
@SCREEN
D=A
@address
M=D // address = SCREEN
(FILL_LOOP)
@i
D=M
@FILL_END
D;JEQ // if i == 0 goto FILL_END
@fill_value
D=M
@address
A=M
M=D // *address = fill_value
@address
M=M+1 // address++
@i
M=M-1 // i--
@FILL_LOOP
0;JMP
(FILL_END)
@fill_value
D=M
@WAIT_KEY_PRESS
D;JEQ // if fill_value = 0 then goto WAIT_KEY_PRESS
@WAIT_KEY_RELEASE
0;JMP // else goto WAIT_KEY_RELEASE
|
; A171510: Generalized Lucas numbers: a(n) = 10*a(n-1) + a(n-2), with a(1)=2 and a(2)=1.
; Submitted by Christian Krause
; 2,1,12,121,1222,12341,124632,1258661,12711242,128371081,1296422052,13092591601,132222338062,1335315972221,13485382060272,136189136574941,1375376747809682,13889956614671761,140274942894527292,1416639385559944681,14306668798493974102,144483327370499685701,1459139942503490831112,14735882752405407996821,148817967466557570799322,1502915557417981115990041,15177973541646368730699732,153282650973881668422987361,1548004483280463052960573342,15633327483778512198028720781,157881279321065585033247781152
mov $2,1
mov $4,2
lpb $0
sub $0,1
mov $3,$4
mov $4,$2
mul $2,10
add $2,$3
lpe
mov $0,$4
|
BluesHouse_h:
db HOUSE ; tileset
db BLUES_HOUSE_HEIGHT, BLUES_HOUSE_WIDTH ; dimensions
dw BluesHouseBlocks, BluesHouseTextPointers, BluesHouseScript
db 0
dw BluesHouseObject
|
%include "boot.inc"
section loader vstart=LOADER_BASE_ADDR
LOADER_STACK_TOP equ LOADER_BASE_ADDR
; 这里其实就是GDT的起始地址,第一个描述符为空
GDT_BASE: dd 0x00000000
dd 0x00000000
; 代码段描述符,一个dd为4字节,段描述符为8字节,上面为低4字节
CODE_DESC: dd 0x0000FFFF
dd DESC_CODE_HIGH4
; 栈段描述符,和数据段共用
DATA_STACK_DESC: dd 0x0000FFFF
dd DESC_DATA_HIGH4
; 显卡段,非平坦
VIDEO_DESC: dd 0x80000007
dd DESC_VIDEO_HIGH4
GDT_SIZE equ $ - GDT_BASE
GDT_LIMIT equ GDT_SIZE - 1
times 120 dd 0
SELECTOR_CODE equ (0x0001 << 3) + TI_GDT + RPL0
SELECTOR_DATA equ (0x0002 << 3) + TI_GDT + RPL0
SELECTOR_VIDEO equ (0x0003 << 3) + TI_GDT + RPL0
; 内存大小,单位字节,此处的内存地址是0xb00
total_memory_bytes dd 0
; 全局描述符表前两字节是gdt界限,后四字节是gdt起始地址,将写入gdtr寄存器
gdt_ptr dw GDT_LIMIT
dd GDT_BASE
ards_buf times 244 db 0
ards_nr dw 0
; =============================================================================
; loader程序开始
; 此处偏移地址为0x300或768故mbr.asm处跳转到 LOADER_BASE_ADDR + 0x300 处直接执行
; =============================================================================
loader_start:
xor ebx, ebx
mov edx, 0x534d4150
mov di, ards_buf
.e820_mem_get_loop:
mov eax, 0x0000e820
mov ecx, 20
int 0x15
jc .e820_mem_get_failed
add di, cx
inc word [ards_nr]
cmp ebx, 0
jnz .e820_mem_get_loop
mov cx, [ards_nr]
mov ebx, ards_buf
xor edx, edx
.find_max_mem_area:
mov eax, [ebx]
add eax, [ebx + 8]
add ebx, 20
cmp edx, eax
jge .next_ards
mov edx, eax
.next_ards:
loop .find_max_mem_area
jmp .mem_get_ok
; 内存检测失败,不再继续向下执行,打印failed
.e820_mem_get_failed:
mov byte [gs:0], 'f'
mov byte [gs:2], 'a'
mov byte [gs:4], 'i'
mov byte [gs:6], 'l'
mov byte [gs:8], 'e'
mov byte [gs:10], 'd'
jmp $
.mem_get_ok:
mov [total_memory_bytes], edx
; 三步进入保护模式
; 第一步: 打开A20地址线,以访问更大内存空间(Chapter 4.3.3 ,157页)
in al, 0x92
or al, 00000010B
out 0x92, al
; 第二步: 加载gdt,通过lgdt指令设置gdtr寄存器
lgdt [gdt_ptr]
; 第三步: 打开保护模式开关,进入保护模式
; 将cr0寄存器第0位(即Protection Enable位)置1
mov eax, cr0
or eax, 0x00000001
mov cr0, eax
; 刷新流水线
jmp dword SELECTOR_CODE:p_mode_start
; 后面全是32位程序
[bits 32]
p_mode_start:
mov ax, SELECTOR_DATA
mov ds, ax
mov es, ax
mov ss, ax
mov esp, LOADER_STACK_TOP
mov ax, SELECTOR_VIDEO
mov gs, ax
; 加载kernel到缓冲区
mov eax, KERNEL_START_SECTOR
mov ebx, KERNEL_BIN_BASE_ADDR
mov ecx, 200 ;读取200个扇区(dd写入了200个扇区)
call rd_disk_m_32
call setup_page
; 保存gdt表
sgdt [gdt_ptr]
; 重新设置gdt描述符, 使虚拟地址指向内核的第一个页表
mov ebx, [gdt_ptr + 2]
or dword [ebx + 0x18 + 4], 0xc0000000
add dword [gdt_ptr + 2], 0xc0000000
add esp, 0xc0000000
; 页目录基地址寄存器
mov eax, PAGE_DIR_TABLE_POS
mov cr3, eax
; 打开分页
mov eax, cr0
or eax, 0x80000000
mov cr0, eax
lgdt [gdt_ptr]
; 初始化kernel
jmp SELECTOR_CODE:enter_kernel
enter_kernel:
call kernel_init
mov esp, 0xc009f000
jmp KERNEL_ENTRY_POINT
jmp $
; =============================================================================
; 创建页目录以及页表
; =============================================================================
setup_page:
; 页目录表占据4KB空间,清零之
mov ecx, 4096
mov esi, 0
.clear_page_dir:
mov byte [PAGE_DIR_TABLE_POS + esi], 0
inc esi
loop .clear_page_dir
; 创建页目录表(PDE)
.create_pde:
mov eax, PAGE_DIR_TABLE_POS
; 0x1000为4KB,加上页目录表起始地址便是第一个页表的地址
add eax, 0x1000
mov ebx, eax
; 设置页目录项属性
or eax, PG_US_U | PG_RW_W | PG_P
; 设置第一个页目录项
mov [PAGE_DIR_TABLE_POS], eax
; 第768(内核空间的第一个)个页目录项,与第一个相同,这样第一个和768个都指向低端4MB空间
mov [PAGE_DIR_TABLE_POS + 0xc00], eax
; 最后一个表项指向自己,用于访问页目录本身
sub eax, 0x1000
mov [PAGE_DIR_TABLE_POS + 4092], eax
; 创建页表
mov ecx, 256
mov esi, 0
mov edx, PG_US_U | PG_RW_W | PG_P
.create_pte:
mov [ebx + esi * 4], edx
add edx, 4096
inc esi
loop .create_pte
; 创建内核的其它PDE
mov eax, PAGE_DIR_TABLE_POS
add eax, 0x2000
or eax, PG_US_U | PG_RW_W | PG_P
mov ebx, PAGE_DIR_TABLE_POS
mov ecx, 254
mov esi, 769
.create_kernel_pde:
mov [ebx + esi * 4], eax
inc esi
add eax, 0x1000
loop .create_kernel_pde
ret
; =============================================================================
; =============================================================================
; =============================================================================
; 保护模式的硬盘读取函数: rd_disk_m_32
; =============================================================================
rd_disk_m_32:
mov esi, eax
mov di, cx
mov dx, 0x1f2
mov al, cl
out dx, al
mov eax, esi
; 保存LBA地址
mov dx, 0x1f3
out dx, al
mov cl, 8
shr eax, cl
mov dx, 0x1f4
out dx, al
shr eax, cl
mov dx, 0x1f5
out dx, al
shr eax, cl
and al, 0x0f
or al, 0xe0
mov dx, 0x1f6
out dx, al
mov dx, 0x1f7
mov al, 0x20
out dx, al
.not_ready:
nop
in al, dx
and al, 0x88
cmp al, 0x08
jnz .not_ready
mov ax, di
mov dx, 256
mul dx
mov cx, ax
mov dx, 0x1f0
.go_on_read:
in ax, dx
mov [ds:ebx], ax
add ebx, 2
loop .go_on_read
ret
; =============================================================================
; rd_disk_m_32 函数结束
; =============================================================================
kernel_init:
xor eax, eax
xor ebx, ebx
xor ecx, ecx
xor edx, edx
mov dx, [KERNEL_BIN_BASE_ADDR + 42]
mov ebx, [KERNEL_BIN_BASE_ADDR + 28]
add ebx, KERNEL_BIN_BASE_ADDR
mov cx, [KERNEL_BIN_BASE_ADDR + 44]
.each_segment:
cmp byte [ebx], PT_NULL
je .PTNULL
; 准备mem_cpy参数
push dword [ebx + 16]
mov eax, [ebx + 4]
add eax, KERNEL_BIN_BASE_ADDR
push eax
push dword [ebx + 8]
call mem_cpy
add esp, 12
.PTNULL:
add ebx, edx
loop .each_segment
ret
; =============================================================================
; memory copy
; =============================================================================
mem_cpy:
cld
push ebp
mov ebp, esp
push ecx
mov edi, [ebp + 8]
mov esi, [ebp + 12]
mov ecx, [ebp + 16]
rep movsb
pop ecx
pop ebp
ret |
;================================================================================
;
; "Sixty/5o2"
; _________
;
; v1.0
;
; Sixty/5o2 - minimal bootloader and monitor (r/o) w/ serial connection support
;
; Written by Jan Roesner <jan@roesner.it> for Ben Eater's "Project 6502"
;
; Credits:
; - Ben Eater (Project 6502)
; - Steven Wozniak (bin2hex routine)
; - Anke L. (love, patience & support)
;
;================================================================================
PORTB = $6000 ; VIA port B
PORTA = $6001 ; VIA port A
DDRB = $6002 ; Data Direction Register B
DDRA = $6003 ; Data Direction Register A
IER = $600e ; VIA Interrupt Enable Register
E = %10000000
RW = %01000000
RS = %00100000
Z0 = $00 ; General purpose zero page locations
Z1 = $01
Z2 = $02
Z3 = $03
VIDEO_RAM = $3fde ; $3fde - $3ffd - Video RAM for 32 char LCD display
POSITION_MENU = $3fdc ; initialize positions for menu and cursor in RAM
POSITION_CURSOR = $3fdd
WAIT = $3fdb
WAIT_C = $18 ; global sleep multiplicator (adjust for slower clock)
ISR_FIRST_RUN = $3fda ; used to determine first run of the ISR
PROGRAM_LOCATION = $0200 ; memory location for user programs
.org $8000
;================================================================================
;
; main - routine to initialize the bootloader
;
; Initializes the bootloader, LCD, VIA, Video Ram and prints a welcome message
; ————————————————————————————————————
; Preparatory Ops: none
;
; Returned Values: none
;
; Destroys: .A, .Y, .X
; ————————————————————————————————————
;
;================================================================================
main: ; boot routine, first thing loaded
ldx #$ff ; initialize the stackpointer with 0xff
txs
jsr LCD__initialize
jsr LCD__clear_video_ram
lda #<message ; render the boot screen
ldy #>message
jsr LCD__print
ldx #$20 ; delay further progress for a bit longer
lda #$ff
.wait:
jsr LIB__sleep
dex
bne .wait
jsr MENU_main ; start the menu routine
jmp main ; should the menu ever return ...
;================================================================================
;
; MENU_main - renders a scrollable menu w/ dynamic number of entries
;
; ————————————————————————————————————
; Preparatory Ops: none
;
; Returned Values: none
;
; Destroys: .A, .X, .Y
; ————————————————————————————————————
;
;================================================================================
MENU_main:
lda #0 ; since in RAM, positions need initialization
sta POSITION_MENU
sta POSITION_CURSOR
jmp .start
.MAX_SCREEN_POS: ; define some constants in ROM
.byte $05 ; its always number of items - 2, here its 6 windows ($00-$05) in 7 items
.OFFSETS:
.byte $00, $10, $20, $30, $40, $50 ; content offsets for all 6 screen windows
.start: ; and off we go
jsr LCD__clear_video_ram
ldx POSITION_MENU
ldy .OFFSETS,X
; load first offset into Y
ldx #0 ; set X to 0
.loop:
lda menu_items,Y ; load string char for Y
sta VIDEO_RAM,X ; store in video ram at X
iny
inx
cpx #$20 ; repeat 32 times
bne .loop
.render_cursor: ; render cursor position based on current state
lda #">"
ldy POSITION_CURSOR
bne .lower_cursor
sta VIDEO_RAM
jmp .render
.lower_cursor:
sta VIDEO_RAM+$10
.render: ; and update the screen
jsr LCD__render
.wait_for_input: ; handle keyboard input
ldx #4
lda #$ff ; debounce
.wait:
jsr LIB__sleep
dex
bne .wait
lda #0
jsr VIA__read_keyboard_input
beq .wait_for_input ; no
.handle_keyboard_input:
cmp #$01
beq .move_up ; UP key pressed
cmp #$02
beq .move_down ; DOWN key pressed
cmp #$08
beq .select_option ; RIGHT key pressed
lda #0 ; explicitly setting A is a MUST here
jmp .wait_for_input ; and go around
.move_up:
lda POSITION_CURSOR ; load cursor position
beq .dec_menu_offset ; is cursor in up position? yes?
lda #0 ; no?
sta POSITION_CURSOR ; set cursor in up position
jmp .start ; re-render the whole menu
.dec_menu_offset:
lda POSITION_MENU
beq .wait_for_input ; yes, just re-render
.decrease:
dec POSITION_MENU ; decrease menu position by one
jmp .start ; and re-render
.move_down:
lda POSITION_CURSOR ; load cursor position
cmp #1 ; is cursor in lower position?
beq .inc_menu_offset ; yes?
lda #1 ; no?
sta POSITION_CURSOR ; set cursor in lower position
jmp .start ; and re-render the whole menu
.inc_menu_offset:
lda POSITION_MENU ; load current menu positions
cmp .MAX_SCREEN_POS ; are we at the bottom yet?
bne .increase ; no?
jmp .wait_for_input ; yes
.increase:
adc #1 ; increase menu position
sta POSITION_MENU
jmp .start ; and re-render
.select_option:
clc
lda #0 ; clear A
adc POSITION_MENU
adc POSITION_CURSOR ; calculate index of selected option
cmp #0 ; branch trough all options
beq .load_and_run
cmp #1
beq .load
cmp #2
beq .run
cmp #3
beq .monitor
cmp #4
beq .clear_ram
cmp #5
beq .about
cmp #6
beq .credits
jmp .end ; should we have an invalid option, restart
.load_and_run: ; load and directly run
jsr .do_load ; load first
jsr .do_run ; run immediately after
jmp .start ; should a program ever return ...
.load: ; load program and go back into menu
jsr .do_load
jmp .start
.run: ; run a program already loaded
jsr .do_run
jmp .start
.monitor: ; start up the monitor
lda #<PROGRAM_LOCATION ; have it render the start location
ldy #>PROGRAM_LOCATION ; can also be set as params during debugging
jsr MONITOR__main
jmp .start
.clear_ram: ; start the clear ram routine
jsr BOOTLOADER__clear_ram
jmp .start
.about: ; start the about routine
lda #<about
ldy #>about
ldx #3
jsr LCD__print_text
jmp .start
.credits: ; start the credits routine
lda #<credits
ldy #>credits
ldx #3
jsr LCD__print_text
jmp .start
.do_load: ; orchestration of program loading
lda #$ff ; wait a bit
jsr LIB__sleep
jsr BOOTLOADER__program_ram ; call the bootloaders programming routine
rts
.do_run: ; orchestration of running a program
jmp BOOTLOADER__execute
.end
jmp .start ; should we ever reach this point ...
;================================================================================
;
; BOOTLOADER__program_ram - writes serial data to RAM
;
; Used in conjunction w/ the ISR, orchestrates user program reading
; ————————————————————————————————————
; Preparatory Ops: none
;
; Returned Values: none
; none
; Destroys: .A, .X, .Y
; ————————————————————————————————————
;
;================================================================================
BOOTLOADER__program_ram:
CURRENT_RAM_ADDRESS_L = Z0
CURRENT_RAM_ADDRESS_H = Z1
LOADING_STATE = Z2
lda #%01111111 ; we disable all 6522 interrupts!!!
sta IER
lda #0 ; for a reason I dont get, the ISR is triggered...
sta ISR_FIRST_RUN ; one time before the first byte arrives, so we mitigate here
jsr LCD__clear_video_ram
lda #<message4 ; Rendering a message
ldy #>message4
jsr LCD__print
lda #$00 ; initializing loading state byte
sta LOADING_STATE
lda #>PROGRAM_LOCATION ; initializing RAM address counter
sta CURRENT_RAM_ADDRESS_H
lda #<PROGRAM_LOCATION
sta CURRENT_RAM_ADDRESS_L
cli ; enable interrupt handling
lda #%00000000 ; set all pins on port B to input
ldx #%11100001 ; set top 3 pins and bottom ones to on port A to output, 4 middle ones to input
jsr VIA__configure_ddrs
.wait_for_first_data:
lda LOADING_STATE ; checking loading state
cmp #$00 ; the ISR will set to $01 as soon as a byte is read
beq .wait_for_first_data
.loading_data:
lda #$02 ; assuming we're done loading, we set loading state to $02
sta LOADING_STATE
ldx #$20 ; then we wait for * cycles !!!! Increase w/ instable loading
lda #$ff
.loop:
jsr LIB__sleep
dex
bne .loop
lda LOADING_STATE ; check back loading state, which was eventually updated by the ISR
cmp #$02
bne .loading_data
; when no data came in in last * cycles, we're done loading
.done_loading:
lda #%11111111 ; Reset VIA ports for output, set all pins on port B to output
ldx #%11100000 ; set top 3 pins and bottom ones to on port A to output, 5 middle ones to input
jsr VIA__configure_ddrs
jsr LCD__clear_video_ram
lda #<message6
ldy #>message6
jsr LCD__print
ldx #$20 ; wait a moment before we return to main menu
lda #$ff
.loop_messagedisplay:
jsr LIB__sleep
dex
bne .loop_messagedisplay
rts
;================================================================================
;
; BOOTLOADER__execute - executes a user program in RAM
;
; Program needs to be loaded via serial loader or other mechanism beforehand
; ————————————————————————————————————
; Preparatory Ops: none
;
; Returned Values: none
;
; Destroys: .A, .Y
; ————————————————————————————————————
;
;================================================================================
BOOTLOADER__execute:
sei ; disable interrupt handling
jsr LCD__clear_video_ram ; print a message
lda #<message7
ldy #>message7
jsr LCD__print
jmp PROGRAM_LOCATION ; and jump to program location
;================================================================================
;
; BOOTLOADER__clear_ram - clears RAM from $0200 up to $3fff
;
; Useful during debugging or when using non-volatile RAM chips
; ————————————————————————————————————
; Preparatory Ops: none
;
; Returned Values: none
;
; Destroys: .A, .Y
; ————————————————————————————————————
;
;================================================================================
BOOTLOADER__clear_ram:
jsr LCD__clear_video_ram ; render message
lda #<message8
ldy #>message8
jsr LCD__print
ldy #<PROGRAM_LOCATION ; load start location into zero page
sty Z0
lda #>PROGRAM_LOCATION
sta Z1
lda #$00 ; load 0x00 cleaner byte
.loop:
sta (Z0),Y ; store it in current location
iny ; increase 16 bit address by 0x01
bne .loop
inc Z1
bit Z1 ; V is set on bit 6 (= $40)
bvs .loop
rts ; yes, return from subroutine
;================================================================================
;
; MONITOR__main - RAM/ROM Hexmonitor (r/o)
;
; Currently read only, traverses RAM and ROM locations, shows hex data contents
; ————————————————————————————————————
; Preparatory Ops: none
;
; Returned Values: none
;
; Destroys: .A, .X, .Y
; ————————————————————————————————————
;
;================================================================================
MONITOR__main:
sta Z0 ; store LSB
sty Z1 ; store MSB
.render_current_ram_location:
jsr LCD__clear_video_ram
lda #$00 ; select upper row of video ram
sta Z3 ; #TODO
jsr .transform_contents ; load and transform ram and address bytes
clc ; add offset to address
lda Z0
adc #$04
sta Z0
bcc .skip
inc Z1
.skip:
lda #$01 ; select lower row of video ram
sta Z3
jsr .transform_contents ; load and transform ram and address bytes there
jsr LCD__render
.wait_for_input: ; wait for key press
ldx #$04 ; debounce #TODO
.wait:
lda #$ff
jsr LIB__sleep
dex
bne .wait
lda #0
jsr VIA__read_keyboard_input
beq .wait_for_input ; a key was pressed? no
.handle_keyboard_input: ; determine action for key pressed
cmp #$01
beq .move_up ; UP key pressed
cmp #$02
beq .move_down ; DOWN key pressed
cmp #$04
beq .exit_monitor ; LEFT key pressed
cmp #$08
beq .fast_forward ; RIGHT key pressed
lda #0 ; explicitly setting A is a MUST here
jmp .wait_for_input
.exit_monitor:
lda #0 ; needed for whatever reason
rts
.move_down:
jmp .render_current_ram_location ; no math needed, the address is up to date already
.move_up:
sec ; decrease the 16bit RAM Pointer
lda Z0
sbc #$08
sta Z0
lda Z1
sbc #$00
sta Z1
jmp .render_current_ram_location ; and re-render
.fast_forward: ; add $0800 to current RAM location
sec
lda Z0
adc #$00
sta Z0
lda Z1
adc #$04
sta Z1
jmp .render_current_ram_location ; and re-render
.transform_contents: ; start reading address and ram contents into stack
ldy #3
.iterate_ram: ; transfer 4 ram bytes to stack
lda (Z0),Y
pha
dey
bne .iterate_ram
lda (Z0),Y
pha
lda Z0 ; transfer the matching address bytes to stack too
pha
lda Z1
pha
ldy #0
.iterate_stack: ; transform stack contents from bin to hex
cpy #6
beq .end
sty Z2 ; preserve Y #TODO
pla
jsr LIB__bin_to_hex
ldy Z2 ; restore Y
pha ; push least sign. nibble (LSN) onto stack
txa
pha ; push most sign. nibble (MSN) too
tya ; calculate nibble positions in video ram
adc MON__position_map,Y ; use the static map for that
tax
pla
jsr .store_nibble ; store MSN to video ram
inx
pla
jsr .store_nibble ; store LSN to video ram
iny
jmp .iterate_stack ; repeat for all 6 bytes on stack
.store_nibble: ; subroutine to store nibbles in two lcd rows
pha
lda Z3
beq .store_upper_line ; should we store in upper line? yes
pla ; no, store in lower line
sta VIDEO_RAM+$10,X
jmp .end_store
.store_upper_line ; upper line storage
pla
sta VIDEO_RAM,X
.end_store:
rts
.end:
lda #":" ; writing the two colons
sta VIDEO_RAM+$4
sta VIDEO_RAM+$14
rts
;================================================================================
;
; VIA__read_keyboard_input - returns 4-key keyboard inputs
;
; Input is read, normalized and returned to the caller
; ————————————————————————————————————
; Preparatory Ops: none
;
; Returned Values: .A: (UP: $1, DOWN: $2, LEFT: $4, RIGHT: $8)
;
; Destroys: .A
; ————————————————————————————————————
;
;================================================================================
VIA__read_keyboard_input:
lda PORTA ; load current key status from VIA
ror ; normalize the input to $1, $2, $4 and $8
and #$0f ; ignore first 4 bits
eor #$0f ; deactivate / comment this line, if your keyboard
; is built with buttons tied normal low, when
; pushed turning high (in contrast to Ben's schematics)
rts
;================================================================================
;
; VIA__configure_ddrs - configures data direction registers of the VIA chip
;
; Expects one byte per register with bitwise setup input/output directions
; ————————————————————————————————————
; Preparatory Ops: .A: Byte for DDRB
; .X: Byte for DDRA
;
; Returned Values: none
;
; Destroys: none
; ————————————————————————————————————
;
;================================================================================
VIA__configure_ddrs:
sta DDRB ; configure data direction for port B from A reg.
stx DDRA ; configure data direction for port A from X reg.
rts
;================================================================================
;
; LCD__clear_video_ram - clears the Video Ram segment with 0x00 bytes
;
; Useful before rendering new contents by writing to the video ram
; ————————————————————————————————————
; Preparatory Ops: none
;
; Returned Values: none
;
; Destroys: none
; ————————————————————————————————————
;
;================================================================================
LCD__clear_video_ram:
pha ; preserve A via stack
tya ; same for Y
pha
ldy #$20 ; set index to 32
lda #$20 ; set character to 'space'
.loop:
sta VIDEO_RAM,Y ; clean video ram
dey ; decrease index
bne .loop ; are we done? no, repeat
sta VIDEO_RAM ; yes, write zero'th location manually
pla ; restore Y
tay
pla ; restore A
rts
;================================================================================
;
; LCD__print - prints a string to the LCD (highlevel)
;
; String must be given as address pointer, subroutines are called
; The given string is automatically broken into the second display line and
; the render routines are called automatically
;
; Important: String MUST NOT be zero terminated
; ————————————————————————————————————
; Preparatory Ops: .A: LSN String Address
; .Y: MSN String Address
; Returned Values: none
;
; Destroys: .A, .X, .Y
; ————————————————————————————————————
;
;================================================================================
LCD__print:
ldx #0 ; set offset to 0 as default
jsr LCD__print_with_offset ; call printing subroutine
rts
;================================================================================
;
; LCD__print_with_offset - prints string on LCD screen at given offset
;
; String must be given as address pointer, subroutines are called
; The given string is automatically broken into the second display line and
; the render routines are called automatically
;
; Important: String MUST NOT be zero terminated
; ————————————————————————————————————
; Preparatory Ops: .A: LSN String Address
; .Y: MSN String Address
; .X: Offset Byte
; Returned Values: none
;
; Destroys: .A, .X, .Y
; ————————————————————————————————————
;
;================================================================================
LCD__print_with_offset:
STRING_ADDRESS_PTR = Z0
sta STRING_ADDRESS_PTR ; load t_string lsb
sty STRING_ADDRESS_PTR+1 ; load t_string msb
stx Z2 ; X can not directly be added to A, therefore we store it #TODO
ldy #0
.loop:
clc
tya
adc Z2 ; compute offset based on given offset and current cursor position
tax
lda (STRING_ADDRESS_PTR),Y ; load char from given string at position Y
beq .return ; is string terminated via 0x00? yes
sta VIDEO_RAM,X ; no - store char to video ram
iny
jmp .loop ; loop until we find 0x00
.return:
jsr LCD__render ; render video ram contents to LCD screen aka scanline
rts
;================================================================================
;
; LCD__print_text - prints a scrollable / escapeable multiline text (highlevel)
;
; The text location must be given as memory pointer, the number of pages to
; be rendered needs to be given as well
;
; Important: The text MUST be zero terminated
; ————————————————————————————————————
; Preparatory Ops: .A: LSN Text Address
; .Y: MSN Text Address
; .X: Page Number Byte
; Returned Values: none
;
; Destroys: .A, .X, .Y
; ————————————————————————————————————
;
;================================================================================
LCD__print_text:
sta Z0 ; store text pointer in zero page
sty Z1
dex ; reduce X by one to get cardinality of pages
stx Z2 ; store given number of pages
.CURRENT_PAGE = Z3
lda #0
sta Z3
.render_page:
jsr LCD__clear_video_ram ; clear video ram
ldy #0 ; reset character index
.render_chars:
lda (Z0),Y ; load character from given text at current character index
cmp #$00
beq .do_render ; text ended? yes then render
sta VIDEO_RAM,Y ; no, store char in video ram at current character index
iny ; increase index
bne .render_chars ; repeat with next char
.do_render:
jsr LCD__render ; render current content to screen
.wait_for_input: ; handle keyboard input
ldx #4
.wait:
lda #$ff ; debounce
jsr LIB__sleep
dex
bne .wait
lda #0
jsr VIA__read_keyboard_input
bne .handle_keyboard_input ; do we have input? yes?
jmp .wait_for_input ; no
.handle_keyboard_input:
cmp #$01
beq .move_up ; UP key pressed
cmp #$02
beq .move_down ; DOWN key pressed
cmp #$04
beq .exit ; LEFT key pressed
lda #0 ; Explicitly setting A is a MUST here
jmp .wait_for_input
.exit:
rts
.move_up:
lda .CURRENT_PAGE ; are we on the first page?
beq .wait_for_input ; yes, just ignore the keypress and wait for next one
dec .CURRENT_PAGE ; no, decrease current page by 1
sec ; decrease reading pointer by 32 bytes
lda Z0
sbc #$20
sta Z0
bcs .skipdec
dec Z1
.skipdec:
jmp .render_page ; and re-render
.move_down:
lda .CURRENT_PAGE ; load current page
cmp Z2 ; are we on last page already
beq .wait_for_input ; yes, just ignore keypress and wait for next one
inc .CURRENT_PAGE ; no, increase current page by 1
clc ; add 32 to the text pointer
lda Z0
adc #$20
sta Z0
bcc .skipinc
inc Z1
.skipinc:
jmp .render_page ; and re-render
;================================================================================
;
; LCD__initialize - initializes the LCD display
;
; ————————————————————————————————————
; Preparatory Ops: none
;
; Returned Values: none
;
; Destroys: .A, .X
; ————————————————————————————————————
;
;================================================================================
LCD__initialize:
lda #%11111111 ; set all pins on port B to output
ldx #%11100000 ; set top 3 pins and bottom ones to on port A to output, 5 middle ones to input
jsr VIA__configure_ddrs
lda #%00111000 ; set 8-bit mode, 2-line display, 5x8 font
jsr LCD__send_instruction
lda #%00001110 ; display on, cursor on, blink off
jsr LCD__send_instruction
lda #%00000110 ; increment and shift cursor, don't shift display
jmp LCD__send_instruction
;================================================================================
;
; LCD__set_cursor - sets the cursor on hardware level into upper or lower row
;
; Always positions the cursor in the first column of the chosen row
; ————————————————————————————————————
; Preparatory Ops: .A: byte representing upper or lower row
;
; Returned Values: none
;
; Destroys: .A
; ————————————————————————————————————
;
;================================================================================
LCD__set_cursor:
jmp LCD__send_instruction
;================================================================================
;
; LCD__set_cursor_second_line - sets cursor to second row, first column
;
; Low level convenience function
; ————————————————————————————————————
; Preparatory Ops: none
;
; Returned Values: none
;
; Destroys: none
; ————————————————————————————————————
;
;================================================================================
LCD__set_cursor_second_line:
pha ; preserve A
lda #%11000000 ; set cursor to line 2 hardly
jsr LCD__send_instruction
pla ; restore A
rts
;================================================================================
;
; LCD__render - transfers Video Ram contents onto the LCD display
;
; Automatically breaks text into the second row if necessary but takes the
; additional LCD memory into account
; ————————————————————————————————————
; Preparatory Ops: Content in Video Ram needs to be available
;
; Returned Values: none
;
; Destroys: .A, .X, .Y
; ————————————————————————————————————
;
;================================================================================
LCD__render:
lda #%10000000 ; force cursor to first line
jsr LCD__set_cursor
ldx #0
.write_char: ; start writing chars from video ram
lda VIDEO_RAM,X ; read video ram char at X
cpx #$10 ; are we done with the first line?
beq .next_line ; yes - move on to second line
cpx #$20 ; are we done with 32 chars?
beq .return ; yes, return from routine
jsr LCD__send_data ; no, send data to lcd
inx
jmp .write_char ; repeat with next char
.next_line:
jsr LCD__set_cursor_second_line ; set cursort into line 2
jsr LCD__send_data ; send dataa to lcd
inx
jmp .write_char ; repear with next char
.return:
rts
;================================================================================
;
; LCD__check_busy_flag - returns the LCD's busy status flag
;
; Since the LCD needs clock cycles internally to process instructions, it can
; not handle instructions at all times. Therefore it provides a busy flag,
; which when 0 signals, that the LCD is ready to accept the next instruction
; ————————————————————————————————————
; Preparatory Ops: none
;
; Returned Values: .A: LCD's busy flag (busy: $01, ready: $00)
;
; Destroys: .A
; ————————————————————————————————————
;
;================================================================================
LCD__check_busy_flag:
lda #0 ; clear port A
sta PORTA ; clear RS/RW/E bits
lda #RW ; prepare read mode
sta PORTA
bit PORTB ; read data from LCD
bpl .ready ; bit 7 not set -> ready
lda #1 ; bit 7 set, LCD is still busy, need waiting
rts
.ready:
lda #0
.return:
rts
;================================================================================
;
; LCD__send_instruction - sends a control instruction to the LCD display
;
; In contrast to data, the LCD accepts a number of control instructions as well
; This routine can be used, to send arbitrary instructions following the LCD's
; specification
; ————————————————————————————————————
; Preparatory Ops: .A: control byte (see LCD manual)
;
; Returned Values: none
;
; Destroys: .A
; ————————————————————————————————————
;
;================================================================================
LCD__send_instruction:
pha ; preserve A
.loop ; wait until LCD becomes ready
jsr LCD__check_busy_flag
bne .loop
pla ; restore A
sta PORTB ; write accumulator content into PORTB
lda #E
sta PORTA ; set E bit to send instruction
lda #0
sta PORTA ; clear RS/RW/E bits
rts
;================================================================================
;
; LCD__send_data - sends content data to the LCD controller
;
; In contrast to instructions, there seems to be no constraint, and data can
; be sent at any rate to the display (see LCD__send_instruction)
; ————————————————————————————————————
; Preparatory Ops: .A: Content Byte
;
; Returned Values: none
;
; Destroys: .A
; ————————————————————————————————————
;
;================================================================================
LCD__send_data:
sta PORTB ; write accumulator content into PORTB
lda #(RS | E)
sta PORTA ; set E bit AND register select bit to send instruction
lda #0
sta PORTA ; clear RS/RW/E bits
rts
;================================================================================
;
; LIB__bin_to_hex: CONVERT BINARY BYTE TO HEX ASCII CHARS - THX Woz!
;
; Slighty modified version - original from Steven Wozniak for Apple I
; ————————————————————————————————————
; Preparatory Ops: .A: byte to convert
;
; Returned Values: .A: LSN ASCII char
; .X: MSN ASCII char
; ————————————————————————————————————
;
;================================================================================
LIB__bin_to_hex:
ldy #$ff ; state for output switching #TODO
pha ; save A for LSD
lsr
lsr
lsr
lsr ; MSD to LSD position
jsr .to_hex ; output hex digit, using internal recursion
pla ; restore A
.to_hex
and #%00001111 ; mask LSD for hex print
ora #"0" ; add "0"
cmp #"9"+1 ; is it a decimal digit?
bcc .output ; yes! output it
adc #6 ; add offset for letter A-F
.output
iny ; set switch for second nibble processing
bne .return ; did we process second nibble already? yes
tax ; no
.return
rts
;================================================================================
;
; LIB__sleep - sleeps for a given amount of cycles
;
; The routine does not actually sleep, but wait by burning cycles in TWO(!)
; nested loops. The user can configure the number of inner cycles via .A.
; In addition there is an outer loop, which nests the inner one, hence multiplies
; the number of burned cycles for ALL LIB__sleep calls by a globals multiplier.
;
; This way the whole codebase can easily be adjusted to other clock rates then
; 1MHz. The global number of outer cycles for 1MHz is $18 and stored in WAIT
;
; Unfortunately this calls for errors, where the global wait is not set back
; correctly. PR welcome
; ————————————————————————————————————
; Preparatory Ops: .A: byte representing the sleep duration
;
; Returned Values: none
;
; Destroys: .Y
; ————————————————————————————————————
;
;================================================================================
LIB__sleep:
ldy #WAIT_C
sty WAIT
.outerloop:
tay
.loop:
dey
bne .loop
dec WAIT
bne .outerloop
rts
message:
.asciiz "Sixty/5o2 Bootloader v0.2"
message2:
.asciiz "Enter Command..."
message3:
.asciiz "Programming RAM"
message4:
.asciiz "Awaiting data..."
message6:
.asciiz "Loading done!"
message7:
.asciiz "Running $0x200"
message8:
.asciiz "Cleaning RAM Patience please!"
MON__position_map:
.byte $00, $01, $03, $05, $07, $09
menu_items:
.text " Load & Run "
.text " Load "
.text " Run "
.text " Monitor "
.text " Clear RAM "
.text " About "
.text " Credits "
about:
.asciiz "Sixty/5o2 Bootloader and Monitor written by Jan Roesner <jan@roesner.it>git.io/JvTM1 "
credits:
.asciiz "Ben Eater 6502 Project Steven Wozniak bin2hex routine Anke L. love & patience"
;================================================================================
;
; ISR - Interrupt Service Routine
;
; This might be the most naive approach to serial RAM writing ever, but it is
; enormously stable and effective.
;
; Whenever the Arduino set up a data bit on the 8 data lines of VIA PortB, it
; pulls the 6502's interrupt line low for 3 microseconds. This triggers an
; interrupt, and causes the 6502 to lookup the ISR entry vector in memory
; location $fffe and $ffff. This is, where this routines address is put, so
; each time an interrupt is triggered, this routine is called.
;
; The routine reads the current byte from VIA PortB, writes it to the RAM and
; increases the RAM address by $01.
;
; In addition it REsets the LOADING_STATE byte, so the BOOTLOADER__program_ram
; routine knows, there is still data flowing in. Since there is no "Control Byte"
; that can be used to determine EOF, it is ust assumed, that EOF is reached, when
; no data came in for a defined number of cycles.
;
; Important: Due to the current hardware design (interrupt line) there is no
; way to have the ISR service different interrupt calls.
;
; Important: The routine is put as close to the end of the ROM as possible to
; not fragment the ROM for additional routines. In case of additional
; operations, the entry address needs recalculation!
;
; ————————————————————————————————————
; Preparatory Ops: none
;
; Returned Values: none
;
; Destroys: none
; ————————————————————————————————————
;
;================================================================================
.org $FFC9 ; as close as possible to the ROM's end
ISR:
CURRENT_RAM_ADDRESS = Z0 ; a RAM address handle for indirect writing
pha
tya
pha
; for a reason I dont get, the ISR is called once with 0x00
lda ISR_FIRST_RUN ; check whether we are called for the first time
bne .write_data ; if not, just continue writing
lda #1 ; otherwise set the first time marker
sta ISR_FIRST_RUN ; and return from the interrupt
jmp .doneisr
.write_data:
lda #$01 ; progressing state of loading operation
sta LOADING_STATE ; so program_ram routine knows, data's still flowing
lda PORTB ; load serial data byte
ldy #0
sta (CURRENT_RAM_ADDRESS),Y ; store byte at current RAM location
; increase the 16bit RAM location
inc CURRENT_RAM_ADDRESS_L
bne .doneisr
inc CURRENT_RAM_ADDRESS_H
.doneisr
pla ; restore Y
tay
pla ; restore A
rti
.org $fffc
.word main ; entry vector main routine
.word ISR ; entry vector interrupt service routine
|
; A172285: a(n) = (5*2^n - 5*(-1)^n - 3*n*(-1)^n) / 9.
; 0,2,1,6,7,20,33,74,139,288,565,1142,2271,4556,9097,18210,36403,72824,145629,291278,582535,1165092,2330161,4660346,9320667,18641360,37282693,74565414,149130799,298261628,596523225,1193046482,2386092931,4772185896,9544371757,19088743550,38177487063,76354974164,152709948289,305419896618,610839793195,1221679586432,2443359172821,4886718345686,9773436691327,19546873382700,39093746765353,78187493530754,156374987061459,312749974122968,625499948245885,1250999896491822,2501999792983591,5003999585967236,10007999171934417,20015998343868890,40031996687737723,80063993375475504,160127986750950949,320255973501901958,640511947003803855,1281023894007607772,2562047788015215481,5124095576030431026,10248191152060861987,20496382304121724040,40992764608243448013,81985529216486896094,163971058432973792119,327942116865947584308,655884233731895168545,1311768467463790337162,2623536934927580674251,5247073869855161348576,10494147739710322697077,20988295479420645394230,41976590958841290788383,83953181917682581576844,167906363835365163153609,335812727670730326307298,671625455341460652614515,1343250910682921305229112,2686501821365842610458141,5373003642731685220916366,10746007285463370441832647,21492014570926740883665380,42984029141853481767330673,85968058283706963534661434,171936116567413927069322779,343872233134827854138645648,687744466269655708277291205,1375488932539311416554582502,2750977865078622833109164911,5501955730157245666218329916,11003911460314491332436659737,22007822920628982664873319570,44015645841257965329746639043,88031291682515930659493278184,176062583365031861318986556269,352125166730063722637973112638
mov $5,2
mov $6,$0
lpb $5
mov $0,$6
mov $3,0
sub $5,1
add $0,$5
sub $0,1
lpb $0
mov $2,$0
trn $0,2
max $2,0
seq $2,115102 ; a(0)=2, a(1)=8, a(n)=a(n-1)+2*a(n-2).
add $3,$2
lpe
mov $4,$5
mul $4,$3
add $1,$4
mov $7,$3
lpe
min $6,1
mul $6,$7
sub $1,$6
div $1,4
mov $0,$1
|
###############################################################################
# Copyright 2018 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.
###############################################################################
.text
.p2align 6, 0x90
.globl _k0_cpMontMul1024_avx2
_k0_cpMontMul1024_avx2:
push %rbx
push %rbp
push %r12
push %r13
push %r14
sub $(32), %rsp
mov %rdx, %rbp
movslq %r8d, %r8
vzeroall
vmovdqu %ymm0, (%rsi,%r8,8)
vmovdqu %ymm0, (%rcx,%r8,8)
xor %r10, %r10
vmovdqu %ymm0, (%rsp)
.p2align 6, 0x90
.Lloop4_Bgas_1:
movq (%rbp), %rbx
vpbroadcastq (%rbp), %ymm0
mov %rbx, %r10
imulq (%rsi), %r10
addq (%rsp), %r10
mov %r10, %rdx
imul %r9d, %edx
and $(134217727), %edx
mov %rbx, %r11
imulq (8)(%rsi), %r11
addq (8)(%rsp), %r11
mov %rbx, %r12
imulq (16)(%rsi), %r12
addq (16)(%rsp), %r12
mov %rbx, %r13
imulq (24)(%rsi), %r13
addq (24)(%rsp), %r13
vmovd %edx, %xmm11
vpbroadcastq %xmm11, %ymm11
vpmuludq (32)(%rsi), %ymm0, %ymm12
vpaddq %ymm12, %ymm1, %ymm1
vpmuludq (64)(%rsi), %ymm0, %ymm13
vpaddq %ymm13, %ymm2, %ymm2
vpmuludq (96)(%rsi), %ymm0, %ymm14
vpaddq %ymm14, %ymm3, %ymm3
vpmuludq (128)(%rsi), %ymm0, %ymm12
vpaddq %ymm12, %ymm4, %ymm4
vpmuludq (160)(%rsi), %ymm0, %ymm13
vpaddq %ymm13, %ymm5, %ymm5
vpmuludq (192)(%rsi), %ymm0, %ymm14
vpaddq %ymm14, %ymm6, %ymm6
vpmuludq (224)(%rsi), %ymm0, %ymm12
vpaddq %ymm12, %ymm7, %ymm7
vpmuludq (256)(%rsi), %ymm0, %ymm13
vpaddq %ymm13, %ymm8, %ymm8
vpmuludq (288)(%rsi), %ymm0, %ymm14
vpaddq %ymm14, %ymm9, %ymm9
mov %rdx, %rax
imulq (%rcx), %rax
add %rax, %r10
shr $(27), %r10
mov %rdx, %rax
imulq (8)(%rcx), %rax
add %rax, %r11
add %r10, %r11
mov %rdx, %rax
imulq (16)(%rcx), %rax
add %rax, %r12
mov %rdx, %rax
imulq (24)(%rcx), %rax
add %rax, %r13
vpmuludq (32)(%rcx), %ymm11, %ymm12
vpaddq %ymm12, %ymm1, %ymm1
vpmuludq (64)(%rcx), %ymm11, %ymm13
vpaddq %ymm13, %ymm2, %ymm2
vpmuludq (96)(%rcx), %ymm11, %ymm14
vpaddq %ymm14, %ymm3, %ymm3
vpmuludq (128)(%rcx), %ymm11, %ymm12
vpaddq %ymm12, %ymm4, %ymm4
vpmuludq (160)(%rcx), %ymm11, %ymm13
vpaddq %ymm13, %ymm5, %ymm5
vpmuludq (192)(%rcx), %ymm11, %ymm14
vpaddq %ymm14, %ymm6, %ymm6
vpmuludq (224)(%rcx), %ymm11, %ymm12
vpaddq %ymm12, %ymm7, %ymm7
vpmuludq (256)(%rcx), %ymm11, %ymm13
vpaddq %ymm13, %ymm8, %ymm8
vpmuludq (288)(%rcx), %ymm11, %ymm14
vpaddq %ymm14, %ymm9, %ymm9
movq (8)(%rbp), %rbx
vpbroadcastq (8)(%rbp), %ymm0
mov %rbx, %rax
imulq (%rsi), %rax
add %rax, %r11
mov %r11, %rdx
imul %r9d, %edx
and $(134217727), %edx
mov %rbx, %rax
imulq (8)(%rsi), %rax
add %rax, %r12
mov %rbx, %rax
imulq (16)(%rsi), %rax
add %rax, %r13
vmovd %edx, %xmm11
vpbroadcastq %xmm11, %ymm11
vpmuludq (24)(%rsi), %ymm0, %ymm12
vpaddq %ymm12, %ymm1, %ymm1
vpmuludq (56)(%rsi), %ymm0, %ymm13
vpaddq %ymm13, %ymm2, %ymm2
vpmuludq (88)(%rsi), %ymm0, %ymm14
vpaddq %ymm14, %ymm3, %ymm3
vpmuludq (120)(%rsi), %ymm0, %ymm12
vpaddq %ymm12, %ymm4, %ymm4
vpmuludq (152)(%rsi), %ymm0, %ymm13
vpaddq %ymm13, %ymm5, %ymm5
vpmuludq (184)(%rsi), %ymm0, %ymm14
vpaddq %ymm14, %ymm6, %ymm6
vpmuludq (216)(%rsi), %ymm0, %ymm12
vpaddq %ymm12, %ymm7, %ymm7
vpmuludq (248)(%rsi), %ymm0, %ymm13
vpaddq %ymm13, %ymm8, %ymm8
vpmuludq (280)(%rsi), %ymm0, %ymm14
vpaddq %ymm14, %ymm9, %ymm9
mov %rdx, %rax
imulq (%rcx), %rax
add %rax, %r11
shr $(27), %r11
mov %rdx, %rax
imulq (8)(%rcx), %rax
add %rax, %r12
add %r11, %r12
mov %rdx, %rax
imulq (16)(%rcx), %rax
add %rax, %r13
vpmuludq (24)(%rcx), %ymm11, %ymm12
vpaddq %ymm12, %ymm1, %ymm1
vpmuludq (56)(%rcx), %ymm11, %ymm13
vpaddq %ymm13, %ymm2, %ymm2
vpmuludq (88)(%rcx), %ymm11, %ymm14
vpaddq %ymm14, %ymm3, %ymm3
vpmuludq (120)(%rcx), %ymm11, %ymm12
vpaddq %ymm12, %ymm4, %ymm4
vpmuludq (152)(%rcx), %ymm11, %ymm13
vpaddq %ymm13, %ymm5, %ymm5
vpmuludq (184)(%rcx), %ymm11, %ymm14
vpaddq %ymm14, %ymm6, %ymm6
vpmuludq (216)(%rcx), %ymm11, %ymm12
vpaddq %ymm12, %ymm7, %ymm7
vpmuludq (248)(%rcx), %ymm11, %ymm13
vpaddq %ymm13, %ymm8, %ymm8
vpmuludq (280)(%rcx), %ymm11, %ymm14
vpaddq %ymm14, %ymm9, %ymm9
sub $(2), %r8
jz .Lexit_loop_Bgas_1
movq (16)(%rbp), %rbx
vpbroadcastq (16)(%rbp), %ymm0
mov %rbx, %rax
imulq (%rsi), %rax
add %rax, %r12
mov %r12, %rdx
imul %r9d, %edx
and $(134217727), %edx
mov %rbx, %rax
imulq (8)(%rsi), %rax
add %rax, %r13
vmovd %edx, %xmm11
vpbroadcastq %xmm11, %ymm11
vpmuludq (16)(%rsi), %ymm0, %ymm12
vpaddq %ymm12, %ymm1, %ymm1
vpmuludq (48)(%rsi), %ymm0, %ymm13
vpaddq %ymm13, %ymm2, %ymm2
vpmuludq (80)(%rsi), %ymm0, %ymm14
vpaddq %ymm14, %ymm3, %ymm3
vpmuludq (112)(%rsi), %ymm0, %ymm12
vpaddq %ymm12, %ymm4, %ymm4
vpmuludq (144)(%rsi), %ymm0, %ymm13
vpaddq %ymm13, %ymm5, %ymm5
vpmuludq (176)(%rsi), %ymm0, %ymm14
vpaddq %ymm14, %ymm6, %ymm6
vpmuludq (208)(%rsi), %ymm0, %ymm12
vpaddq %ymm12, %ymm7, %ymm7
vpmuludq (240)(%rsi), %ymm0, %ymm13
vpaddq %ymm13, %ymm8, %ymm8
vpmuludq (272)(%rsi), %ymm0, %ymm14
vpaddq %ymm14, %ymm9, %ymm9
mov %rdx, %rax
imulq (%rcx), %rax
add %rax, %r12
shr $(27), %r12
mov %rdx, %rax
imulq (8)(%rcx), %rax
add %rax, %r13
add %r12, %r13
vpmuludq (16)(%rcx), %ymm11, %ymm12
vpaddq %ymm12, %ymm1, %ymm1
vpmuludq (48)(%rcx), %ymm11, %ymm13
vpaddq %ymm13, %ymm2, %ymm2
vpmuludq (80)(%rcx), %ymm11, %ymm14
vpaddq %ymm14, %ymm3, %ymm3
vpmuludq (112)(%rcx), %ymm11, %ymm12
vpaddq %ymm12, %ymm4, %ymm4
vpmuludq (144)(%rcx), %ymm11, %ymm13
vpaddq %ymm13, %ymm5, %ymm5
vpmuludq (176)(%rcx), %ymm11, %ymm14
vpaddq %ymm14, %ymm6, %ymm6
vpmuludq (208)(%rcx), %ymm11, %ymm12
vpaddq %ymm12, %ymm7, %ymm7
vpmuludq (240)(%rcx), %ymm11, %ymm13
vpaddq %ymm13, %ymm8, %ymm8
vpmuludq (272)(%rcx), %ymm11, %ymm14
vpaddq %ymm14, %ymm9, %ymm9
movq (24)(%rbp), %rbx
vpbroadcastq (24)(%rbp), %ymm0
imulq (%rsi), %rbx
add %rbx, %r13
mov %r13, %rdx
imul %r9d, %edx
and $(134217727), %edx
vmovd %edx, %xmm11
vpbroadcastq %xmm11, %ymm11
vpmuludq (8)(%rsi), %ymm0, %ymm12
vpaddq %ymm12, %ymm1, %ymm1
vpmuludq (40)(%rsi), %ymm0, %ymm13
vpaddq %ymm13, %ymm2, %ymm2
vpmuludq (72)(%rsi), %ymm0, %ymm14
vpaddq %ymm14, %ymm3, %ymm3
vpmuludq (104)(%rsi), %ymm0, %ymm12
vpaddq %ymm12, %ymm4, %ymm4
vpmuludq (136)(%rsi), %ymm0, %ymm13
vpaddq %ymm13, %ymm5, %ymm5
vpmuludq (168)(%rsi), %ymm0, %ymm14
vpaddq %ymm14, %ymm6, %ymm6
vpmuludq (200)(%rsi), %ymm0, %ymm12
vpaddq %ymm12, %ymm7, %ymm7
vpmuludq (232)(%rsi), %ymm0, %ymm13
vpaddq %ymm13, %ymm8, %ymm8
vpmuludq (264)(%rsi), %ymm0, %ymm14
vpaddq %ymm14, %ymm9, %ymm9
vpmuludq (296)(%rsi), %ymm0, %ymm10
imulq (%rcx), %rdx
add %rdx, %r13
shr $(27), %r13
vmovq %r13, %xmm14
vpmuludq (8)(%rcx), %ymm11, %ymm12
vpaddq %ymm12, %ymm1, %ymm1
vpaddq %ymm14, %ymm1, %ymm1
vmovdqu %ymm1, (%rsp)
vpmuludq (40)(%rcx), %ymm11, %ymm13
vpaddq %ymm13, %ymm2, %ymm1
vpmuludq (72)(%rcx), %ymm11, %ymm14
vpaddq %ymm14, %ymm3, %ymm2
vpmuludq (104)(%rcx), %ymm11, %ymm12
vpaddq %ymm12, %ymm4, %ymm3
vpmuludq (136)(%rcx), %ymm11, %ymm13
vpaddq %ymm13, %ymm5, %ymm4
vpmuludq (168)(%rcx), %ymm11, %ymm14
vpaddq %ymm14, %ymm6, %ymm5
vpmuludq (200)(%rcx), %ymm11, %ymm12
vpaddq %ymm12, %ymm7, %ymm6
vpmuludq (232)(%rcx), %ymm11, %ymm13
vpaddq %ymm13, %ymm8, %ymm7
vpmuludq (264)(%rcx), %ymm11, %ymm14
vpaddq %ymm14, %ymm9, %ymm8
vpmuludq (296)(%rcx), %ymm11, %ymm12
vpaddq %ymm12, %ymm10, %ymm9
add $(32), %rbp
sub $(2), %r8
jnz .Lloop4_Bgas_1
.Lexit_loop_Bgas_1:
movq %r12, (%rdi)
movq %r13, (8)(%rdi)
vmovdqu %ymm1, (16)(%rdi)
vmovdqu %ymm2, (48)(%rdi)
vmovdqu %ymm3, (80)(%rdi)
vmovdqu %ymm4, (112)(%rdi)
vmovdqu %ymm5, (144)(%rdi)
vmovdqu %ymm6, (176)(%rdi)
vmovdqu %ymm7, (208)(%rdi)
vmovdqu %ymm8, (240)(%rdi)
vmovdqu %ymm9, (272)(%rdi)
mov $(38), %r8
xor %rax, %rax
.Lnorm_loopgas_1:
addq (%rdi), %rax
add $(8), %rdi
mov $(134217727), %rdx
and %rax, %rdx
shr $(27), %rax
movq %rdx, (-8)(%rdi)
sub $(1), %r8
jg .Lnorm_loopgas_1
movq %rax, (%rdi)
add $(32), %rsp
vzeroupper
pop %r14
pop %r13
pop %r12
pop %rbp
pop %rbx
ret
|
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r13
push %r9
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_A_ht+0x11f68, %rsi
lea addresses_WT_ht+0xf354, %rdi
inc %r13
mov $127, %rcx
rep movsb
sub $43323, %rdx
lea addresses_D_ht+0x92ac, %rsi
lea addresses_A_ht+0x3d5c, %rdi
nop
nop
nop
and %r9, %r9
mov $79, %rcx
rep movsb
nop
nop
nop
xor $60264, %rdx
lea addresses_UC_ht+0x33dc, %r13
nop
nop
nop
nop
and %r10, %r10
mov $0x6162636465666768, %rdx
movq %rdx, %xmm2
movups %xmm2, (%r13)
nop
nop
nop
nop
nop
cmp $40010, %rdx
lea addresses_A_ht+0x14a5c, %rsi
lea addresses_A_ht+0x191d4, %rdi
inc %r12
mov $5, %rcx
rep movsw
nop
nop
nop
nop
nop
cmp $53419, %rdi
lea addresses_normal_ht+0x12f5c, %r12
nop
nop
nop
nop
dec %r13
mov (%r12), %dx
nop
nop
dec %rdi
lea addresses_WC_ht+0x2c5c, %rsi
lea addresses_normal_ht+0x4c1c, %rdi
nop
nop
nop
nop
nop
add %r10, %r10
mov $1, %rcx
rep movsw
nop
nop
nop
nop
xor $45250, %rsi
lea addresses_D_ht+0x6c5c, %rdi
nop
nop
nop
nop
nop
add $37952, %r12
mov (%rdi), %dx
nop
nop
nop
nop
nop
cmp $22839, %r9
lea addresses_UC_ht+0xd85c, %r10
nop
nop
inc %r13
movb (%r10), %r12b
nop
nop
nop
nop
and %rdi, %rdi
lea addresses_A_ht+0xaedc, %rcx
nop
nop
nop
nop
nop
sub $27670, %r13
movb $0x61, (%rcx)
nop
add %r9, %r9
lea addresses_UC_ht+0x1699c, %rsi
lea addresses_UC_ht+0x17834, %rdi
nop
nop
nop
nop
nop
cmp %r9, %r9
mov $93, %rcx
rep movsw
nop
nop
nop
nop
dec %rsi
lea addresses_A_ht+0xec5c, %r9
nop
nop
add %r13, %r13
and $0xffffffffffffffc0, %r9
vmovntdqa (%r9), %ymm0
vextracti128 $1, %ymm0, %xmm0
vpextrq $0, %xmm0, %rsi
nop
nop
nop
nop
mfence
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r9
pop %r13
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r15
push %r8
push %rax
push %rbp
push %rbx
push %rcx
push %rsi
// Store
lea addresses_RW+0x1415c, %r15
nop
nop
nop
sub %rbp, %rbp
mov $0x5152535455565758, %rbx
movq %rbx, %xmm2
vmovups %ymm2, (%r15)
nop
nop
add $32618, %rbx
// Faulty Load
lea addresses_D+0x1c5c, %rax
nop
nop
nop
xor $60920, %r8
vmovups (%rax), %ymm7
vextracti128 $1, %ymm7, %xmm7
vpextrq $0, %xmm7, %r15
lea oracles, %rax
and $0xff, %r15
shlq $12, %r15
mov (%rax,%r15,1), %r15
pop %rsi
pop %rcx
pop %rbx
pop %rbp
pop %rax
pop %r8
pop %r15
ret
/*
<gen_faulty_load>
[REF]
{'src': {'same': False, 'congruent': 0, 'NT': True, 'type': 'addresses_D', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 8, 'NT': False, 'type': 'addresses_RW', 'size': 32, 'AVXalign': False}}
[Faulty Load]
{'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_D', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_A_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 3, 'same': False}}
{'src': {'type': 'addresses_D_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 6, 'same': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 7, 'NT': False, 'type': 'addresses_UC_ht', 'size': 16, 'AVXalign': False}}
{'src': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 3, 'same': False}}
{'src': {'same': False, 'congruent': 6, 'NT': False, 'type': 'addresses_normal_ht', 'size': 2, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 6, 'same': False}}
{'src': {'same': False, 'congruent': 10, 'NT': False, 'type': 'addresses_D_ht', 'size': 2, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 7, 'NT': False, 'type': 'addresses_UC_ht', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 7, 'NT': True, 'type': 'addresses_A_ht', 'size': 1, 'AVXalign': False}}
{'src': {'type': 'addresses_UC_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 3, 'same': False}}
{'src': {'same': False, 'congruent': 11, 'NT': True, 'type': 'addresses_A_ht', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'}
{'36': 21829}
36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36
*/
|
; π = (4/1) - (4/3) + (4/5) - (4/7) + (4/9) - (4/11) + (4/13) - (4/15) ...
; Take 4 and subtract 4 divided by 3.
; Then add 4 divided by 5.
; Then subtract 4 divided by 7.
; Continue alternating between adding and subtracting fractions with a numerator of 4
; and a denominator of each subsequent odd number. The more times you do this,
; the closer you will get to pi.
pi = $00 ; 3 bytes bc
factor = $03 ; one byte to hold
.incdir "../common"
.org $8000
start:
cld ;clear decimal mode
clc ;clear carry bit
lda #$00
ldx #$ff
txs
ldx #0
jsr div24_init
jsr add24_init
lda #1
sta pi
lda #0
sta pi + 1
sta pi + 2
sta pi + 3
; jsr init_lcd
lda #$ff
sta addX
sta addY
jsr add24;
lda #1
sta dividend
lda #3
sta divisor
jsr div24
lda dividend
sta pi
BEQ
exit:
jmp exit
.include "lcd.asm"
.include "24bit_division.asm"
.include "24bit_add.asm"
.org $fffc
.word start
.word $0000
|
; double __FASTCALL__ tan(double x)
SECTION code_clib
SECTION code_fp_math48
PUBLIC cm48_sccz80_tan
EXTERN am48_tan
defc cm48_sccz80_tan = am48_tan
|
start_up_stage_2: ; 7e1f
mov ecx, STAGE_2_WELCOME
call print_string
;enable A20 line
in al,0x92
or al,2
out 0x92,al
;1) call memory detection and map the memory, and insert to booting info
call memory_map
mov dword [booting_info.memory_map_addr], ebx
mov dword [booting_info.memory_map_count], ecx
call load_kernel_to_memory
;3) protected mode time
call switch_to_protected
;4) call the kernel and let the fun begin.
jmp $
load_kernel_to_memory: ; 0x7e24 on bochs
;2) call unreal mod and load the kernel to high memory address
;2.1) load the kernel to tmp place
;2.2) call unreal mod
;2.3) load to high address
push eax
push ecx
mov bx, stage2_end
mov si,(kernel_end - kernel_start) / 512 ; size of kernel by sector count
mov cl,(kernel_start-stage1_start)/ 512 + 1
mov ch,0
xor dx,dx
call load
; maybe split
mov ax,0
mov es,ax
call unreal
mov edi,KERNEL_ADDR
mov esi,stage2_end
mov ecx, 512 * 256
cld
a32 rep movsb
pop ecx
pop eax
ret
[bits 32]
protected_mode:
;call load_kernel
mov eax, KERNEL_ADDR
add eax, kernel_start
mov ebx, booting_info
call KERNEL_ADDR
hlt
booting_info:
.memory_map_addr: dd 0
.memory_map_count: dd 0
STAGE_2_WELCOME db "[D] Welcome to stage 2 of the boot :)",0
KERNEL_ADDR: equ 0x200000
%include "stage2/unreal_mod.asm"
%include "stage2/memory_detection.asm"
%include "stage2/protected_mod.asm"
%include "stage2/elf.asm"
|
SECTION code_clib
PUBLIC txtgetcursor
PUBLIC _txtgetcursor
.txtgetcursor
._txtgetcursor
jp 0xB82D
|
; A020538: a(n) = 4th Chebyshev polynomial (first kind) evaluated at 2^n.
; 1,97,1921,32257,522241,8380417,134184961,2147352577,34359214081,549753716737,8796084633601,140737454800897,2251799679467521,36028796482093057,576460750155939841,9223372028264841217,147573952555316674561,2361183241297383653377,37778931862407405895681,604462909805115564097537,9671406556908237304627201,154742504910637349990301697,2475880078570619812309893121,39614081257131605846818553857,633825300114112448948537917441,10141204801825826204774370902017,162259276829213327362780991324161
mov $1,4
pow $1,$0
bin $1,2
mul $1,16
add $1,1
mov $0,$1
|
/////////////////////////////////////////////////////////////////////
//
// CopyRight ( c ) 1999 Microsoft Corporation
//
// Module Name: DnsServerDomainContainment.cpp
//
// Description:
// Implementation of CDnsServerDomainContainment class
//
// Author:
// Henry Wang ( henrywa ) March 8, 2000
//
//
//////////////////////////////////////////////////////////////////////
#include "DnsWmi.h"
/////////////////////////////////////////////////////////////////////////////
//++
//
// Description:
// create an instance of CDnsServerDomainContainment
//
// Arguments:
// wszName [IN] class name
// pNamespace [IN] wmi namespace
// szType [IN] child class name of resource record class
//
// Return Value:
// WBEM_S_NO_ERROR
//
//--
/////////////////////////////////////////////////////////////////////////////
CDnsBase*
CDnsServerDomainContainment::CreateThis(
const WCHAR * wszName,
CWbemServices * pNamespace,
const char * szType
)
{
return new CDnsServerDomainContainment(wszName, pNamespace);
}
CDnsServerDomainContainment::CDnsServerDomainContainment()
{
}
CDnsServerDomainContainment::CDnsServerDomainContainment(
const WCHAR* wszName,
CWbemServices *pNamespace)
:CDnsBase(wszName, pNamespace)
{
}
CDnsServerDomainContainment::~CDnsServerDomainContainment()
{
}
/////////////////////////////////////////////////////////////////////////////
//++
//
// Description:
// enum instances of dns server and domain association
//
// Arguments:
// lFlags [IN] WMI flag
// pCtx [IN] WMI context
// pHandler [IN] WMI sink pointer
//
// Return Value:
// WBEM_S_NO_ERROR
//
//--
/////////////////////////////////////////////////////////////////////////////
SCODE
CDnsServerDomainContainment::EnumInstance(
long lFlags,
IWbemContext * pCtx,
IWbemObjectSink * pHandler
)
{
list<CObjPath> opList;
list<CObjPath>::iterator i;
SCODE sc;
CDnsWrap& dns = CDnsWrap::DnsObject();
sc = dns.dnsEnumDomainForServer(&opList);
if (FAILED(sc))
{
return sc;
}
CObjPath opServer;
opServer.SetClass(PVD_CLASS_SERVER);
opServer.AddProperty(
PVD_SRV_SERVER_NAME,
dns.GetServerName().data());
for(i=opList.begin(); i!=opList.end(); ++i)
{
CWbemClassObject Inst;
m_pClass->SpawnInstance(0, &Inst);
Inst.SetProperty(
opServer.GetObjectPathString(),
PVD_ASSOC_PARENT);
Inst.SetProperty(
(*i).GetObjectPathString(),
PVD_ASSOC_CHILD);
pHandler->Indicate(1, &Inst);
}
return WBEM_S_NO_ERROR;
}
/////////////////////////////////////////////////////////////////////////////
//++
//
// Description:
// retrieve server domain association object pointed by the
// given object path
//
// Arguments:
// ObjectPath [IN] object path to object
// lFlags [IN] WMI flag
// pCtx [IN] WMI context
// pHandler [IN] WMI sink pointer
//
// Return Value:
// WBEM_S_NO_ERROR
//
//--
/////////////////////////////////////////////////////////////////////////////
SCODE
CDnsServerDomainContainment::GetObject(
CObjPath & ObjectPath,
long lFlags,
IWbemContext * pCtx,
IWbemObjectSink * pHandler
)
{
return WBEM_E_NOT_SUPPORTED;
}
SCODE
CDnsServerDomainContainment::ExecuteMethod(
CObjPath&,
WCHAR*,
long,
IWbemClassObject*,
IWbemObjectSink*)
{
return WBEM_E_NOT_SUPPORTED;
}
|
.global s_prepare_buffers
s_prepare_buffers:
push %r14
push %r8
push %rax
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WT_ht+0x1acd8, %r14
nop
nop
add %rdx, %rdx
mov (%r14), %r8d
nop
nop
nop
nop
nop
xor $36994, %rdi
lea addresses_normal_ht+0xe62c, %rax
nop
nop
cmp %rcx, %rcx
mov (%rax), %ebp
nop
add %rdx, %rdx
lea addresses_A_ht+0x140c, %rcx
clflush (%rcx)
nop
nop
add $63804, %r8
movb (%rcx), %al
nop
nop
cmp %r8, %r8
lea addresses_D_ht+0x80c, %rcx
clflush (%rcx)
add $34187, %rax
mov (%rcx), %r8
nop
nop
nop
dec %rdx
lea addresses_D_ht+0x1090c, %rax
cmp $47348, %rdi
mov $0x6162636465666768, %rbp
movq %rbp, %xmm5
movups %xmm5, (%rax)
nop
nop
sub %r8, %r8
lea addresses_D_ht+0xb80c, %rcx
clflush (%rcx)
nop
cmp %rax, %rax
mov $0x6162636465666768, %r14
movq %r14, (%rcx)
nop
nop
nop
xor $55287, %rdx
lea addresses_normal_ht+0x12805, %rbp
nop
nop
nop
add %rdx, %rdx
and $0xffffffffffffffc0, %rbp
vmovntdqa (%rbp), %ymm0
vextracti128 $0, %ymm0, %xmm0
vpextrq $1, %xmm0, %r8
nop
nop
cmp $10205, %rdx
lea addresses_normal_ht+0x7acc, %rsi
lea addresses_UC_ht+0xfa0c, %rdi
xor %r8, %r8
mov $117, %rcx
rep movsw
nop
nop
inc %r14
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r8
pop %r14
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r13
push %r14
push %r9
push %rbp
push %rdi
// Load
lea addresses_US+0xee0c, %r13
nop
inc %rbp
mov (%r13), %r11w
nop
nop
nop
nop
sub %r13, %r13
// Load
lea addresses_WC+0x1d572, %r9
clflush (%r9)
nop
nop
nop
nop
nop
inc %r10
movb (%r9), %r13b
sub %r13, %r13
// Faulty Load
lea addresses_WT+0x1400c, %r9
nop
nop
and $707, %r13
movups (%r9), %xmm6
vpextrq $0, %xmm6, %r11
lea oracles, %r9
and $0xff, %r11
shlq $12, %r11
mov (%r9,%r11,1), %r11
pop %rdi
pop %rbp
pop %r9
pop %r14
pop %r13
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_WT', 'same': False, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_US', 'same': False, 'size': 2, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WC', 'same': False, 'size': 1, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_WT', 'same': True, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_WT_ht', 'same': True, 'size': 4, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 4, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A_ht', 'same': True, 'size': 1, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D_ht', 'same': False, 'size': 8, 'congruent': 8, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 16, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 8, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 32, 'congruent': 0, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM'}
{'39': 21829}
39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39
*/
|
// Implementing d = a + b - c in the hack machine language
// Equivalent C Program:
// d = a + b - c
@a
D = M // D <-- a
@b
D = D + M // D <-- D + b = a + b
@c
D = D - M // D <-- D - c = a + b - c
@d
M = D // d <-- D = a + b - c
|
adc (ix) ; Error
adc (ix+127) ; Error
adc (ix-128) ; Error
adc (iy) ; Error
adc (iy+127) ; Error
adc (iy-128) ; Error
adc a, (ix) ; Error
adc a, (ix+127) ; Error
adc a, (ix-128) ; Error
adc a, (iy) ; Error
adc a, (iy+127) ; Error
adc a, (iy-128) ; Error
add (ix) ; Error
add (ix+127) ; Error
add (ix-128) ; Error
add (iy) ; Error
add (iy+127) ; Error
add (iy-128) ; Error
add a, (ix) ; Error
add a, (ix+127) ; Error
add a, (ix-128) ; Error
add a, (iy) ; Error
add a, (iy+127) ; Error
add a, (iy-128) ; Error
add ix, bc ; Error
add ix, de ; Error
add ix, ix ; Error
add ix, sp ; Error
add iy, bc ; Error
add iy, de ; Error
add iy, iy ; Error
add iy, sp ; Error
add sp, -128 ; Error
add sp, 127 ; Error
adi hl, -128 ; Error
adi hl, 127 ; Error
adi hl, 255 ; Error
adi sp, -128 ; Error
adi sp, 127 ; Error
adi sp, 255 ; Error
and (ix) ; Error
and (ix+127) ; Error
and (ix-128) ; Error
and (iy) ; Error
and (iy+127) ; Error
and (iy-128) ; Error
and a, (ix) ; Error
and a, (ix+127) ; Error
and a, (ix-128) ; Error
and a, (iy) ; Error
and a, (iy+127) ; Error
and a, (iy-128) ; Error
bit 0, (hl) ; Error
bit 0, a ; Error
bit 0, b ; Error
bit 0, c ; Error
bit 0, d ; Error
bit 0, e ; Error
bit 0, h ; Error
bit 0, l ; Error
bit 1, (hl) ; Error
bit 1, a ; Error
bit 1, b ; Error
bit 1, c ; Error
bit 1, d ; Error
bit 1, e ; Error
bit 1, h ; Error
bit 1, l ; Error
bit 2, (hl) ; Error
bit 2, a ; Error
bit 2, b ; Error
bit 2, c ; Error
bit 2, d ; Error
bit 2, e ; Error
bit 2, h ; Error
bit 2, l ; Error
bit 3, (hl) ; Error
bit 3, a ; Error
bit 3, b ; Error
bit 3, c ; Error
bit 3, d ; Error
bit 3, e ; Error
bit 3, h ; Error
bit 3, l ; Error
bit 4, (hl) ; Error
bit 4, a ; Error
bit 4, b ; Error
bit 4, c ; Error
bit 4, d ; Error
bit 4, e ; Error
bit 4, h ; Error
bit 4, l ; Error
bit 5, (hl) ; Error
bit 5, a ; Error
bit 5, b ; Error
bit 5, c ; Error
bit 5, d ; Error
bit 5, e ; Error
bit 5, h ; Error
bit 5, l ; Error
bit 6, (hl) ; Error
bit 6, a ; Error
bit 6, b ; Error
bit 6, c ; Error
bit 6, d ; Error
bit 6, e ; Error
bit 6, h ; Error
bit 6, l ; Error
bit 7, (hl) ; Error
bit 7, a ; Error
bit 7, b ; Error
bit 7, c ; Error
bit 7, d ; Error
bit 7, e ; Error
bit 7, h ; Error
bit 7, l ; Error
cmp (ix) ; Error
cmp (ix+127) ; Error
cmp (ix-128) ; Error
cmp (iy) ; Error
cmp (iy+127) ; Error
cmp (iy-128) ; Error
cmp a, (ix) ; Error
cmp a, (ix+127) ; Error
cmp a, (ix-128) ; Error
cmp a, (iy) ; Error
cmp a, (iy+127) ; Error
cmp a, (iy-128) ; Error
cp (ix) ; Error
cp (ix+127) ; Error
cp (ix-128) ; Error
cp (iy) ; Error
cp (iy+127) ; Error
cp (iy-128) ; Error
cp a, (ix) ; Error
cp a, (ix+127) ; Error
cp a, (ix-128) ; Error
cp a, (iy) ; Error
cp a, (iy+127) ; Error
cp a, (iy-128) ; Error
dec (ix) ; Error
dec (ix+127) ; Error
dec (ix-128) ; Error
dec (iy) ; Error
dec (iy+127) ; Error
dec (iy-128) ; Error
dec ix ; Error
dec iy ; Error
djnz ASMPC ; Error
djnz b, ASMPC ; Error
ex (sp), ix ; Error
ex (sp), iy ; Error
ex af, af ; Error
ex af, af' ; Error
exx ; Error
im 0 ; Error
im 1 ; Error
im 2 ; Error
in (c) ; Error
in a, (c) ; Error
in b, (c) ; Error
in c, (c) ; Error
in d, (c) ; Error
in e, (c) ; Error
in f, (c) ; Error
in h, (c) ; Error
in l, (c) ; Error
inc (ix) ; Error
inc (ix+127) ; Error
inc (ix-128) ; Error
inc (iy) ; Error
inc (iy+127) ; Error
inc (iy-128) ; Error
inc ix ; Error
inc iy ; Error
ind ; Error
indr ; Error
ini ; Error
inir ; Error
jk -32768 ; Error
jk 32767 ; Error
jk 65535 ; Error
jnk -32768 ; Error
jnk 32767 ; Error
jnk 65535 ; Error
jnx5 -32768 ; Error
jnx5 32767 ; Error
jnx5 65535 ; Error
jp (ix) ; Error
jp (iy) ; Error
jr ASMPC ; Error
jr c, ASMPC ; Error
jr nc, ASMPC ; Error
jr nz, ASMPC ; Error
jr z, ASMPC ; Error
jx5 -32768 ; Error
jx5 32767 ; Error
jx5 65535 ; Error
ld (-32768), bc ; Error
ld (-32768), de ; Error
ld (-32768), ix ; Error
ld (-32768), iy ; Error
ld (-32768), sp ; Error
ld (32767), bc ; Error
ld (32767), de ; Error
ld (32767), ix ; Error
ld (32767), iy ; Error
ld (32767), sp ; Error
ld (65535), bc ; Error
ld (65535), de ; Error
ld (65535), ix ; Error
ld (65535), iy ; Error
ld (65535), sp ; Error
ld (c), a ; Error
ld (de), hl ; Error
ld (hl+), a ; Error
ld (hl-), a ; Error
ld (hld), a ; Error
ld (hli), a ; Error
ld (ix), -128 ; Error
ld (ix), 127 ; Error
ld (ix), 255 ; Error
ld (ix), a ; Error
ld (ix), b ; Error
ld (ix), c ; Error
ld (ix), d ; Error
ld (ix), e ; Error
ld (ix), h ; Error
ld (ix), l ; Error
ld (ix+127), -128 ; Error
ld (ix+127), 127 ; Error
ld (ix+127), 255 ; Error
ld (ix+127), a ; Error
ld (ix+127), b ; Error
ld (ix+127), c ; Error
ld (ix+127), d ; Error
ld (ix+127), e ; Error
ld (ix+127), h ; Error
ld (ix+127), l ; Error
ld (ix-128), -128 ; Error
ld (ix-128), 127 ; Error
ld (ix-128), 255 ; Error
ld (ix-128), a ; Error
ld (ix-128), b ; Error
ld (ix-128), c ; Error
ld (ix-128), d ; Error
ld (ix-128), e ; Error
ld (ix-128), h ; Error
ld (ix-128), l ; Error
ld (iy), -128 ; Error
ld (iy), 127 ; Error
ld (iy), 255 ; Error
ld (iy), a ; Error
ld (iy), b ; Error
ld (iy), c ; Error
ld (iy), d ; Error
ld (iy), e ; Error
ld (iy), h ; Error
ld (iy), l ; Error
ld (iy+127), -128 ; Error
ld (iy+127), 127 ; Error
ld (iy+127), 255 ; Error
ld (iy+127), a ; Error
ld (iy+127), b ; Error
ld (iy+127), c ; Error
ld (iy+127), d ; Error
ld (iy+127), e ; Error
ld (iy+127), h ; Error
ld (iy+127), l ; Error
ld (iy-128), -128 ; Error
ld (iy-128), 127 ; Error
ld (iy-128), 255 ; Error
ld (iy-128), a ; Error
ld (iy-128), b ; Error
ld (iy-128), c ; Error
ld (iy-128), d ; Error
ld (iy-128), e ; Error
ld (iy-128), h ; Error
ld (iy-128), l ; Error
ld a, (c) ; Error
ld a, (hl+) ; Error
ld a, (hl-) ; Error
ld a, (hld) ; Error
ld a, (hli) ; Error
ld a, (ix) ; Error
ld a, (ix+127) ; Error
ld a, (ix-128) ; Error
ld a, (iy) ; Error
ld a, (iy+127) ; Error
ld a, (iy-128) ; Error
ld a, i ; Error
ld a, ixh ; Error
ld a, ixl ; Error
ld a, iyh ; Error
ld a, iyl ; Error
ld a, r ; Error
ld b, (ix) ; Error
ld b, (ix+127) ; Error
ld b, (ix-128) ; Error
ld b, (iy) ; Error
ld b, (iy+127) ; Error
ld b, (iy-128) ; Error
ld b, ixh ; Error
ld b, ixl ; Error
ld b, iyh ; Error
ld b, iyl ; Error
ld bc, (-32768) ; Error
ld bc, (32767) ; Error
ld bc, (65535) ; Error
ld bc, ix ; Error
ld bc, iy ; Error
ld c, (ix) ; Error
ld c, (ix+127) ; Error
ld c, (ix-128) ; Error
ld c, (iy) ; Error
ld c, (iy+127) ; Error
ld c, (iy-128) ; Error
ld c, ixh ; Error
ld c, ixl ; Error
ld c, iyh ; Error
ld c, iyl ; Error
ld d, (ix) ; Error
ld d, (ix+127) ; Error
ld d, (ix-128) ; Error
ld d, (iy) ; Error
ld d, (iy+127) ; Error
ld d, (iy-128) ; Error
ld d, ixh ; Error
ld d, ixl ; Error
ld d, iyh ; Error
ld d, iyl ; Error
ld de, (-32768) ; Error
ld de, (32767) ; Error
ld de, (65535) ; Error
ld de, hl+127 ; Error
ld de, hl+255 ; Error
ld de, hl-128 ; Error
ld de, ix ; Error
ld de, iy ; Error
ld e, (ix) ; Error
ld e, (ix+127) ; Error
ld e, (ix-128) ; Error
ld e, (iy) ; Error
ld e, (iy+127) ; Error
ld e, (iy-128) ; Error
ld e, ixh ; Error
ld e, ixl ; Error
ld e, iyh ; Error
ld e, iyl ; Error
ld h, (ix) ; Error
ld h, (ix+127) ; Error
ld h, (ix-128) ; Error
ld h, (iy) ; Error
ld h, (iy+127) ; Error
ld h, (iy-128) ; Error
ld hl, (de) ; Error
ld hl, ix ; Error
ld hl, iy ; Error
ld hl, sp+255 ; Error
ld i, a ; Error
ld ix, (-32768) ; Error
ld ix, (32767) ; Error
ld ix, (65535) ; Error
ld ix, -32768 ; Error
ld ix, 32767 ; Error
ld ix, 65535 ; Error
ld ix, bc ; Error
ld ix, de ; Error
ld ix, hl ; Error
ld ix, iy ; Error
ld ixh, -128 ; Error
ld ixh, 127 ; Error
ld ixh, 255 ; Error
ld ixh, a ; Error
ld ixh, b ; Error
ld ixh, c ; Error
ld ixh, d ; Error
ld ixh, e ; Error
ld ixh, ixh ; Error
ld ixh, ixl ; Error
ld ixl, -128 ; Error
ld ixl, 127 ; Error
ld ixl, 255 ; Error
ld ixl, a ; Error
ld ixl, b ; Error
ld ixl, c ; Error
ld ixl, d ; Error
ld ixl, e ; Error
ld ixl, ixh ; Error
ld ixl, ixl ; Error
ld iy, (-32768) ; Error
ld iy, (32767) ; Error
ld iy, (65535) ; Error
ld iy, -32768 ; Error
ld iy, 32767 ; Error
ld iy, 65535 ; Error
ld iy, bc ; Error
ld iy, de ; Error
ld iy, hl ; Error
ld iy, ix ; Error
ld iyh, -128 ; Error
ld iyh, 127 ; Error
ld iyh, 255 ; Error
ld iyh, a ; Error
ld iyh, b ; Error
ld iyh, c ; Error
ld iyh, d ; Error
ld iyh, e ; Error
ld iyh, iyh ; Error
ld iyh, iyl ; Error
ld iyl, -128 ; Error
ld iyl, 127 ; Error
ld iyl, 255 ; Error
ld iyl, a ; Error
ld iyl, b ; Error
ld iyl, c ; Error
ld iyl, d ; Error
ld iyl, e ; Error
ld iyl, iyh ; Error
ld iyl, iyl ; Error
ld l, (ix) ; Error
ld l, (ix+127) ; Error
ld l, (ix-128) ; Error
ld l, (iy) ; Error
ld l, (iy+127) ; Error
ld l, (iy-128) ; Error
ld r, a ; Error
ld sp, (-32768) ; Error
ld sp, (32767) ; Error
ld sp, (65535) ; Error
ld sp, ix ; Error
ld sp, iy ; Error
ldd (hl), a ; Error
ldd a, (hl) ; Error
ldh (-128), a ; Error
ldh (127), a ; Error
ldh (255), a ; Error
ldh (c), a ; Error
ldh a, (-128) ; Error
ldh a, (127) ; Error
ldh a, (255) ; Error
ldh a, (c) ; Error
ldhi -128 ; Error
ldhi 127 ; Error
ldhi 255 ; Error
ldhl sp, -128 ; Error
ldhl sp, 127 ; Error
ldi (hl), a ; Error
ldi a, (hl) ; Error
ldsi -128 ; Error
ldsi 127 ; Error
ldsi 255 ; Error
lhlde ; Error
lhlx ; Error
or (ix) ; Error
or (ix+127) ; Error
or (ix-128) ; Error
or (iy) ; Error
or (iy+127) ; Error
or (iy-128) ; Error
or a, (ix) ; Error
or a, (ix+127) ; Error
or a, (ix-128) ; Error
or a, (iy) ; Error
or a, (iy+127) ; Error
or a, (iy-128) ; Error
otdr ; Error
otir ; Error
out (c), 0 ; Error
out (c), a ; Error
out (c), b ; Error
out (c), c ; Error
out (c), d ; Error
out (c), e ; Error
out (c), h ; Error
out (c), l ; Error
outd ; Error
outi ; Error
ovrst8 ; Error
pop ix ; Error
pop iy ; Error
push ix ; Error
push iy ; Error
res 0, (hl) ; Error
res 0, a ; Error
res 0, b ; Error
res 0, c ; Error
res 0, d ; Error
res 0, e ; Error
res 0, h ; Error
res 0, l ; Error
res 1, (hl) ; Error
res 1, a ; Error
res 1, b ; Error
res 1, c ; Error
res 1, d ; Error
res 1, e ; Error
res 1, h ; Error
res 1, l ; Error
res 2, (hl) ; Error
res 2, a ; Error
res 2, b ; Error
res 2, c ; Error
res 2, d ; Error
res 2, e ; Error
res 2, h ; Error
res 2, l ; Error
res 3, (hl) ; Error
res 3, a ; Error
res 3, b ; Error
res 3, c ; Error
res 3, d ; Error
res 3, e ; Error
res 3, h ; Error
res 3, l ; Error
res 4, (hl) ; Error
res 4, a ; Error
res 4, b ; Error
res 4, c ; Error
res 4, d ; Error
res 4, e ; Error
res 4, h ; Error
res 4, l ; Error
res 5, (hl) ; Error
res 5, a ; Error
res 5, b ; Error
res 5, c ; Error
res 5, d ; Error
res 5, e ; Error
res 5, h ; Error
res 5, l ; Error
res 6, (hl) ; Error
res 6, a ; Error
res 6, b ; Error
res 6, c ; Error
res 6, d ; Error
res 6, e ; Error
res 6, h ; Error
res 6, l ; Error
res 7, (hl) ; Error
res 7, a ; Error
res 7, b ; Error
res 7, c ; Error
res 7, d ; Error
res 7, e ; Error
res 7, h ; Error
res 7, l ; Error
reti ; Error
retn ; Error
rim ; Error
rl (hl) ; Error
rl (ix) ; Error
rl (ix+127) ; Error
rl (ix-128) ; Error
rl (iy) ; Error
rl (iy+127) ; Error
rl (iy-128) ; Error
rl a ; Error
rl b ; Error
rl c ; Error
rl d ; Error
rl e ; Error
rl h ; Error
rl l ; Error
rlc (hl) ; Error
rlc (ix) ; Error
rlc (ix+127) ; Error
rlc (ix-128) ; Error
rlc (iy) ; Error
rlc (iy+127) ; Error
rlc (iy-128) ; Error
rlc a ; Error
rlc b ; Error
rlc c ; Error
rlc d ; Error
rlc e ; Error
rlc h ; Error
rlc l ; Error
rr (hl) ; Error
rr (ix) ; Error
rr (ix+127) ; Error
rr (ix-128) ; Error
rr (iy) ; Error
rr (iy+127) ; Error
rr (iy-128) ; Error
rr a ; Error
rr b ; Error
rr c ; Error
rr d ; Error
rr e ; Error
rr h ; Error
rr l ; Error
rrc (hl) ; Error
rrc (ix) ; Error
rrc (ix+127) ; Error
rrc (ix-128) ; Error
rrc (iy) ; Error
rrc (iy+127) ; Error
rrc (iy-128) ; Error
rrc a ; Error
rrc b ; Error
rrc c ; Error
rrc d ; Error
rrc e ; Error
rrc h ; Error
rrc l ; Error
rstv ; Error
sbc (ix) ; Error
sbc (ix+127) ; Error
sbc (ix-128) ; Error
sbc (iy) ; Error
sbc (iy+127) ; Error
sbc (iy-128) ; Error
sbc a, (ix) ; Error
sbc a, (ix+127) ; Error
sbc a, (ix-128) ; Error
sbc a, (iy) ; Error
sbc a, (iy+127) ; Error
sbc a, (iy-128) ; Error
set 0, (hl) ; Error
set 0, a ; Error
set 0, b ; Error
set 0, c ; Error
set 0, d ; Error
set 0, e ; Error
set 0, h ; Error
set 0, l ; Error
set 1, (hl) ; Error
set 1, a ; Error
set 1, b ; Error
set 1, c ; Error
set 1, d ; Error
set 1, e ; Error
set 1, h ; Error
set 1, l ; Error
set 2, (hl) ; Error
set 2, a ; Error
set 2, b ; Error
set 2, c ; Error
set 2, d ; Error
set 2, e ; Error
set 2, h ; Error
set 2, l ; Error
set 3, (hl) ; Error
set 3, a ; Error
set 3, b ; Error
set 3, c ; Error
set 3, d ; Error
set 3, e ; Error
set 3, h ; Error
set 3, l ; Error
set 4, (hl) ; Error
set 4, a ; Error
set 4, b ; Error
set 4, c ; Error
set 4, d ; Error
set 4, e ; Error
set 4, h ; Error
set 4, l ; Error
set 5, (hl) ; Error
set 5, a ; Error
set 5, b ; Error
set 5, c ; Error
set 5, d ; Error
set 5, e ; Error
set 5, h ; Error
set 5, l ; Error
set 6, (hl) ; Error
set 6, a ; Error
set 6, b ; Error
set 6, c ; Error
set 6, d ; Error
set 6, e ; Error
set 6, h ; Error
set 6, l ; Error
set 7, (hl) ; Error
set 7, a ; Error
set 7, b ; Error
set 7, c ; Error
set 7, d ; Error
set 7, e ; Error
set 7, h ; Error
set 7, l ; Error
shlde ; Error
shlx ; Error
sim ; Error
sla (hl) ; Error
sla (ix) ; Error
sla (ix+127) ; Error
sla (ix-128) ; Error
sla (iy) ; Error
sla (iy+127) ; Error
sla (iy-128) ; Error
sla a ; Error
sla b ; Error
sla c ; Error
sla d ; Error
sla e ; Error
sla h ; Error
sla l ; Error
sli (hl) ; Error
sli (ix) ; Error
sli (ix+127) ; Error
sli (ix-128) ; Error
sli (iy) ; Error
sli (iy+127) ; Error
sli (iy-128) ; Error
sli a ; Error
sli b ; Error
sli c ; Error
sli d ; Error
sli e ; Error
sli h ; Error
sli l ; Error
sll (hl) ; Error
sll (ix) ; Error
sll (ix+127) ; Error
sll (ix-128) ; Error
sll (iy) ; Error
sll (iy+127) ; Error
sll (iy-128) ; Error
sll a ; Error
sll b ; Error
sll c ; Error
sll d ; Error
sll e ; Error
sll h ; Error
sll l ; Error
sra (hl) ; Error
sra (ix) ; Error
sra (ix+127) ; Error
sra (ix-128) ; Error
sra (iy) ; Error
sra (iy+127) ; Error
sra (iy-128) ; Error
sra a ; Error
sra b ; Error
sra c ; Error
sra d ; Error
sra e ; Error
sra h ; Error
sra l ; Error
srl (hl) ; Error
srl (ix) ; Error
srl (ix+127) ; Error
srl (ix-128) ; Error
srl (iy) ; Error
srl (iy+127) ; Error
srl (iy-128) ; Error
srl a ; Error
srl b ; Error
srl c ; Error
srl d ; Error
srl e ; Error
srl h ; Error
srl l ; Error
stop ; Error
sub (ix) ; Error
sub (ix+127) ; Error
sub (ix-128) ; Error
sub (iy) ; Error
sub (iy+127) ; Error
sub (iy-128) ; Error
sub a, (ix) ; Error
sub a, (ix+127) ; Error
sub a, (ix-128) ; Error
sub a, (iy) ; Error
sub a, (iy+127) ; Error
sub a, (iy-128) ; Error
swap (hl) ; Error
swap a ; Error
swap b ; Error
swap c ; Error
swap d ; Error
swap e ; Error
swap h ; Error
swap l ; Error
xor (ix) ; Error
xor (ix+127) ; Error
xor (ix-128) ; Error
xor (iy) ; Error
xor (iy+127) ; Error
xor (iy-128) ; Error
xor a, (ix) ; Error
xor a, (ix+127) ; Error
xor a, (ix-128) ; Error
xor a, (iy) ; Error
xor a, (iy+127) ; Error
xor a, (iy-128) ; Error
|
; A228290: a(n) = n^6 + n^5 + n^4 + n^3 + n^2 + n.
; 0,6,126,1092,5460,19530,55986,137256,299592,597870,1111110,1948716,3257436,5229042,8108730,12204240,17895696,25646166,36012942,49659540,67368420,90054426,118778946,154764792,199411800,254313150,321272406,402321276,499738092,616067010,754137930,917087136,1108378656,1331826342,1591616670,1892332260,2238976116,2636996586,3092313042,3611342280,4201025640,4868856846,5622910566,6471871692,7425065340,8492487570,9684836826,11013546096,12490815792,14129647350,15943877550,17948213556,20158268676,22590598842,25262739810,28193245080,31401724536,34908883806,38736564342,42907784220,47446779660,52379047266,57731386986,63531945792,69810262080,76597310790,83925549246,91828963716,100343116692,109505194890,119354057970,129930287976,141276239496,153436090542,166455894150,180383630700,195269260956,211164779826,228124270842,246203961360,265462278480,285959905686,307759840206,330927451092,355530538020,381639390810,409326849666,438668366136,469742064792,502628805630,537412247190,574178910396,613018243116,654022685442,697287735690,742912017120,790997345376,841648796646,894974776542,951087089700,1010101010100,1072135352106,1137312542226,1205758691592,1277603669160,1352981175630,1432028818086,1514888185356,1601704924092,1692628815570,1787813853210,1887418320816,1991604871536,2100540607542,2214397160430,2333350772340,2457582377796,2587277686266,2722627265442,2863826625240,3011076302520,3164581946526,3324554405046,3491209811292,3664769671500,3845460953250,4033516174506,4229173493376,4432676798592,4644275800710,4864226124030,5092789399236,5330233356756,5576831920842,5832865304370,6098620104360,6374389398216,6660472840686,6957176761542,7264814263980,7583705323740,7914176888946,8256562980666,8611204794192,8978450801040,9358656851670,9752186278926,10159410002196,10580706632292,11016462577050,11467072147650,11932937665656,12414469570776,12912086529342,13426215543510,13957292061180,14505760086636,15072072291906,15656690128842,16260083941920,16882733081760,17525126019366,18187760461086,18871143464292,19575791553780,20302230838890,21050997131346,21822636063816,22617703209192,23436764200590,24280394852070,25149181280076,26043720025596,26964618177042,27912493493850,28887974530800,29891700763056,30924322711926,31986502071342,33078911835060,34202236424580,35357171817786,36544425678306,37764717485592,39018778665720,40307352722910,41631195371766,42991074670236,44387771153292,45822077967330,47294801005290,48806759042496,50358783873216,51951720447942,53586427011390,55263775241220,56984650387476,58749951412746,60560591133042,62417496359400,64321608040200,66273881404206,68275286104326,70326806362092,72429441112860,74584204151730,76792124280186,79054245453456,81371626928592,83745343413270,86176485215310,88666158392916,91215484905636,93825602766042,96497666192130,99232845760440,102032328559896,104897318346366,107829035697942,110828718170940,113897620456620,117037014538626,120248189851146,123532453437792,126891130111200,130325562613350,133837111776606,137427156685476,141097094839092,144848342314410,148682333930130,152600523411336,156604383554856,160695406395342,164875103372070,169145005496460,173506663520316,177961648104786,182511549990042,187157980165680,191902570041840,196746971621046,201692857670766,206741921896692,211895879116740,217156465435770,222525438421026,228004577278296,233595683028792,239300578686750
mov $2,6
lpb $2,1
add $1,2
mul $1,$0
sub $2,1
lpe
div $1,4
mul $1,2
|
;/*****************************************************************************
; * Copyright (c) Texas Instruments Inc 2002, 2003, 2004, 2005
; *
; * Use of this software is controlled by the terms and conditions found in the
; * license agreement under which this software has been supplied.
; *****************************************************************************/
;/** @file _csl_intcIsrDispatch.asm
; *
; * @date 12th June, 2004
; * @author Ruchika Kharwar
; */
.global __CSL_intcDispatcher
.def __CSL_intcVectorTable
.ref __CSL_intcCpuIntrTable
RESV .macro num
.loop num
mvkh __CSL_intcCpuIntrTable,a4
.endloop
.endm
_CSL_intcpush .macro reg
stw reg,*b15--[1]
.endm
_CSL_intcpop .macro reg
ldw *++b15[1],reg
.endm
CALLDISP .macro intr
_CSL_intcpush a0
mvkl __CSL_intcCpuIntrTable, a0
mvkh __CSL_intcCpuIntrTable, a0
ldw *++a0[intr + 1], a0
nop 2
stw a0, *-a0[intr + 1]
_CSL_intcpop a0
bnop a0, 5
.endm
.sect ".csl_vect"
.align 1024
__CSL_intcVectorTable:
__CSL_intcRsv0:
RESV 8
__CSL_intcIsrNMI:
CALLDISP 1
__CSL_intcRsv2:
RESV 8
__CSL_intcRsv3:
RESV 8
__CSL_intcIsr4:
CALLDISP 4
__CSL_intcIsr5:
CALLDISP 5
__CSL_intcIsr6:
CALLDISP 6
__CSL_intcIsr7:
CALLDISP 7
__CSL_intcIsr8:
CALLDISP 8
__CSL_intcIsr9:
CALLDISP 9
__CSL_intcIsr10:
CALLDISP 10
__CSL_intcIsr11:
CALLDISP 11
__CSL_intcIsr12:
CALLDISP 12
__CSL_intcIsr13:
CALLDISP 13
__CSL_intcIsr14:
CALLDISP 14
__CSL_intcIsr15:
CALLDISP 15
|
;
; 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 "vpx_ports/x86_abi_support.asm"
; void vp8_temporal_filter_apply_sse2 | arg
; (unsigned char *frame1, | 0
; unsigned int stride, | 1
; unsigned char *frame2, | 2
; unsigned int block_size, | 3
; int strength, | 4
; int filter_weight, | 5
; unsigned int *accumulator, | 6
; unsigned short *count) | 7
global sym(vp8_temporal_filter_apply_sse2) PRIVATE
sym(vp8_temporal_filter_apply_sse2):
push rbp
mov rbp, rsp
SHADOW_ARGS_TO_STACK 8
SAVE_XMM 7
GET_GOT rbx
push rsi
push rdi
ALIGN_STACK 16, rax
%define block_size 0
%define strength 16
%define filter_weight 32
%define rounding_bit 48
%define rbp_backup 64
%define stack_size 80
sub rsp, stack_size
mov [rsp + rbp_backup], rbp
; end prolog
mov rdx, arg(3)
mov [rsp + block_size], rdx
movd xmm6, arg(4)
movdqa [rsp + strength], xmm6 ; where strength is used, all 16 bytes are read
; calculate the rounding bit outside the loop
; 0x8000 >> (16 - strength)
mov rdx, 16
sub rdx, arg(4) ; 16 - strength
movq xmm4, rdx ; can't use rdx w/ shift
movdqa xmm5, [GLOBAL(_const_top_bit)]
psrlw xmm5, xmm4
movdqa [rsp + rounding_bit], xmm5
mov rsi, arg(0) ; src/frame1
mov rdx, arg(2) ; predictor frame
mov rdi, arg(6) ; accumulator
mov rax, arg(7) ; count
; dup the filter weight and store for later
movd xmm0, arg(5) ; filter_weight
pshuflw xmm0, xmm0, 0
punpcklwd xmm0, xmm0
movdqa [rsp + filter_weight], xmm0
mov rbp, arg(1) ; stride
pxor xmm7, xmm7 ; zero for extraction
lea rcx, [rdx + 16*16*1]
cmp dword ptr [rsp + block_size], 8
jne .temporal_filter_apply_load_16
lea rcx, [rdx + 8*8*1]
.temporal_filter_apply_load_8:
movq xmm0, [rsi] ; first row
lea rsi, [rsi + rbp] ; += stride
punpcklbw xmm0, xmm7 ; src[ 0- 7]
movq xmm1, [rsi] ; second row
lea rsi, [rsi + rbp] ; += stride
punpcklbw xmm1, xmm7 ; src[ 8-15]
jmp .temporal_filter_apply_load_finished
.temporal_filter_apply_load_16:
movdqa xmm0, [rsi] ; src (frame1)
lea rsi, [rsi + rbp] ; += stride
movdqa xmm1, xmm0
punpcklbw xmm0, xmm7 ; src[ 0- 7]
punpckhbw xmm1, xmm7 ; src[ 8-15]
.temporal_filter_apply_load_finished:
movdqa xmm2, [rdx] ; predictor (frame2)
movdqa xmm3, xmm2
punpcklbw xmm2, xmm7 ; pred[ 0- 7]
punpckhbw xmm3, xmm7 ; pred[ 8-15]
; modifier = src_byte - pixel_value
psubw xmm0, xmm2 ; src - pred[ 0- 7]
psubw xmm1, xmm3 ; src - pred[ 8-15]
; modifier *= modifier
pmullw xmm0, xmm0 ; modifer[ 0- 7]^2
pmullw xmm1, xmm1 ; modifer[ 8-15]^2
; modifier *= 3
pmullw xmm0, [GLOBAL(_const_3w)]
pmullw xmm1, [GLOBAL(_const_3w)]
; modifer += 0x8000 >> (16 - strength)
paddw xmm0, [rsp + rounding_bit]
paddw xmm1, [rsp + rounding_bit]
; modifier >>= strength
psrlw xmm0, [rsp + strength]
psrlw xmm1, [rsp + strength]
; modifier = 16 - modifier
; saturation takes care of modifier > 16
movdqa xmm3, [GLOBAL(_const_16w)]
movdqa xmm2, [GLOBAL(_const_16w)]
psubusw xmm3, xmm1
psubusw xmm2, xmm0
; modifier *= filter_weight
pmullw xmm2, [rsp + filter_weight]
pmullw xmm3, [rsp + filter_weight]
; count
movdqa xmm4, [rax]
movdqa xmm5, [rax+16]
; += modifier
paddw xmm4, xmm2
paddw xmm5, xmm3
; write back
movdqa [rax], xmm4
movdqa [rax+16], xmm5
lea rax, [rax + 16*2] ; count += 16*(sizeof(short))
; load and extract the predictor up to shorts
pxor xmm7, xmm7
movdqa xmm0, [rdx]
lea rdx, [rdx + 16*1] ; pred += 16*(sizeof(char))
movdqa xmm1, xmm0
punpcklbw xmm0, xmm7 ; pred[ 0- 7]
punpckhbw xmm1, xmm7 ; pred[ 8-15]
; modifier *= pixel_value
pmullw xmm0, xmm2
pmullw xmm1, xmm3
; expand to double words
movdqa xmm2, xmm0
punpcklwd xmm0, xmm7 ; [ 0- 3]
punpckhwd xmm2, xmm7 ; [ 4- 7]
movdqa xmm3, xmm1
punpcklwd xmm1, xmm7 ; [ 8-11]
punpckhwd xmm3, xmm7 ; [12-15]
; accumulator
movdqa xmm4, [rdi]
movdqa xmm5, [rdi+16]
movdqa xmm6, [rdi+32]
movdqa xmm7, [rdi+48]
; += modifier
paddd xmm4, xmm0
paddd xmm5, xmm2
paddd xmm6, xmm1
paddd xmm7, xmm3
; write back
movdqa [rdi], xmm4
movdqa [rdi+16], xmm5
movdqa [rdi+32], xmm6
movdqa [rdi+48], xmm7
lea rdi, [rdi + 16*4] ; accumulator += 16*(sizeof(int))
cmp rdx, rcx
je .temporal_filter_apply_epilog
pxor xmm7, xmm7 ; zero for extraction
cmp dword ptr [rsp + block_size], 16
je .temporal_filter_apply_load_16
jmp .temporal_filter_apply_load_8
.temporal_filter_apply_epilog:
; begin epilog
mov rbp, [rsp + rbp_backup]
add rsp, stack_size
pop rsp
pop rdi
pop rsi
RESTORE_GOT
RESTORE_XMM
UNSHADOW_ARGS
pop rbp
ret
SECTION_RODATA
align 16
_const_3w:
times 8 dw 3
align 16
_const_top_bit:
times 8 dw 1<<15
align 16
_const_16w:
times 8 dw 16
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/medialive/model/DeviceUpdateStatus.h>
#include <aws/core/utils/HashingUtils.h>
#include <aws/core/Globals.h>
#include <aws/core/utils/EnumParseOverflowContainer.h>
using namespace Aws::Utils;
namespace Aws
{
namespace MediaLive
{
namespace Model
{
namespace DeviceUpdateStatusMapper
{
static const int UP_TO_DATE_HASH = HashingUtils::HashString("UP_TO_DATE");
static const int NOT_UP_TO_DATE_HASH = HashingUtils::HashString("NOT_UP_TO_DATE");
DeviceUpdateStatus GetDeviceUpdateStatusForName(const Aws::String& name)
{
int hashCode = HashingUtils::HashString(name.c_str());
if (hashCode == UP_TO_DATE_HASH)
{
return DeviceUpdateStatus::UP_TO_DATE;
}
else if (hashCode == NOT_UP_TO_DATE_HASH)
{
return DeviceUpdateStatus::NOT_UP_TO_DATE;
}
EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
if(overflowContainer)
{
overflowContainer->StoreOverflow(hashCode, name);
return static_cast<DeviceUpdateStatus>(hashCode);
}
return DeviceUpdateStatus::NOT_SET;
}
Aws::String GetNameForDeviceUpdateStatus(DeviceUpdateStatus enumValue)
{
switch(enumValue)
{
case DeviceUpdateStatus::UP_TO_DATE:
return "UP_TO_DATE";
case DeviceUpdateStatus::NOT_UP_TO_DATE:
return "NOT_UP_TO_DATE";
default:
EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
if(overflowContainer)
{
return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue));
}
return {};
}
}
} // namespace DeviceUpdateStatusMapper
} // namespace Model
} // namespace MediaLive
} // namespace Aws
|
; A274089: Numbers repeated except that powers of 2 only appear once.
; 1,2,3,3,4,5,5,6,6,7,7,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,30,30,31,31,32,33,33,34,34,35,35,36,36,37,37,38,38,39,39,40,40
mov $2,$0
add $0,1
mov $1,$2
lpb $0,1
mul $0,2
sub $0,1
add $1,1
trn $0,$1
lpe
div $1,2
add $1,1
|
// Emulation of the Z80 CPU with hooks into the other parts of z81.
// Copyright (C) 1994 Ian Collier.
// z81 changes (C) 1995-2001 Russell Marks.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include <string.h> //for memset/memcpy
#include "Z80.h"
#include "zx81.h"
#include "gbGlobals.h"
#define parity(a) (partable[a])
unsigned char partable[256]={
4, 0, 0, 4, 0, 4, 4, 0, 0, 4, 4, 0, 4, 0, 0, 4,
0, 4, 4, 0, 4, 0, 0, 4, 4, 0, 0, 4, 0, 4, 4, 0,
0, 4, 4, 0, 4, 0, 0, 4, 4, 0, 0, 4, 0, 4, 4, 0,
4, 0, 0, 4, 0, 4, 4, 0, 0, 4, 4, 0, 4, 0, 0, 4,
0, 4, 4, 0, 4, 0, 0, 4, 4, 0, 0, 4, 0, 4, 4, 0,
4, 0, 0, 4, 0, 4, 4, 0, 0, 4, 4, 0, 4, 0, 0, 4,
4, 0, 0, 4, 0, 4, 4, 0, 0, 4, 4, 0, 4, 0, 0, 4,
0, 4, 4, 0, 4, 0, 0, 4, 4, 0, 0, 4, 0, 4, 4, 0,
0, 4, 4, 0, 4, 0, 0, 4, 4, 0, 0, 4, 0, 4, 4, 0,
4, 0, 0, 4, 0, 4, 4, 0, 0, 4, 4, 0, 4, 0, 0, 4,
4, 0, 0, 4, 0, 4, 4, 0, 0, 4, 4, 0, 4, 0, 0, 4,
0, 4, 4, 0, 4, 0, 0, 4, 4, 0, 0, 4, 0, 4, 4, 0,
4, 0, 0, 4, 0, 4, 4, 0, 0, 4, 4, 0, 4, 0, 0, 4,
0, 4, 4, 0, 4, 0, 0, 4, 4, 0, 0, 4, 0, 4, 4, 0,
0, 4, 4, 0, 4, 0, 0, 4, 4, 0, 0, 4, 0, 4, 4, 0,
4, 0, 0, 4, 0, 4, 4, 0, 0, 4, 4, 0, 4, 0, 0, 4
};
unsigned long tstates=0,tsmax=65000,frames=0;
//odd place to have this, but the display does work in an odd way :-)
unsigned char scrnbmp_new[ZX_VID_FULLWIDTH*ZX_VID_FULLHEIGHT/8]; //written
//checked against for diffs
int liney=0, lineyi=0;
int vsy=0;
unsigned long linestart=0;
int vsync_toggle=0,vsync_lasttoggle=0;
static int linestate=0, linex=0, nrmvideo=1;
#define LINEX ((tstates-linestart)>>2)
//for vsync off -> on
void vsync_raise(void)
{
//save current pos
vsy=liney;
}
//for vsync on -> off
void vsync_lower(void)
{
int ny=liney,y;
vsync_toggle++;
//we don't emulate this stuff by default; if nothing else,
//it can be fscking annoying when you're typing in a program.
if(!vsync_visuals)
return;
//even when we do emulate it, we don't bother with x timing,
//just the y. It gives reasonable results without being too
//complicated, I think.
if(vsy<0) vsy=0;
if(vsy>=ZX_VID_FULLHEIGHT) vsy=ZX_VID_FULLHEIGHT-1;
if(ny<0) ny=0;
if(ny>=ZX_VID_FULLHEIGHT) ny=ZX_VID_FULLHEIGHT-1;
//XXX both of these could/should be made into single memset calls
if(ny<vsy)
{
//must be wrapping around a frame edge; do bottom half
for(y=vsy;y<ZX_VID_FULLHEIGHT;y++)
memset(scrnbmp_new+y*(ZX_VID_FULLWIDTH/8),0xff,ZX_VID_FULLWIDTH/8);
vsy=0;
}
for(y=vsy;y<ny;y++)
memset(scrnbmp_new+y*(ZX_VID_FULLWIDTH/8),0xff,ZX_VID_FULLWIDTH/8);
}
unsigned char a, f, b, c, d, e, h, l;
unsigned char r, a1, f1, b1, c1, d1, e1, h1, l1, i, iff1, iff2, im;
//JJ unsigned short pc;
unsigned short int pc;
unsigned short ix, iy, sp;
unsigned long nextlinetime=0,linegap=208,lastvsyncpend=0;
unsigned char radjust;
unsigned char ixoriy, new_ixoriy;
unsigned char intsample=0;
unsigned char op;
int ulacharline=0;
int nmipend=0,intpend=0,vsyncpend=0,vsynclen=0;
int hsyncskip=0;
int framewait=0;
void ExecZ80(void)
{
int retval=0;
while(1)
{
//this *has* to be checked before radjust is incr'd
if(intsample && !(radjust&64))
intpend=1;
ixoriy=new_ixoriy;
new_ixoriy=0;
intsample=1;
op=fetch(pc&0x7fff);
if (pc&0x8000 && !(op&64) && linestate==0) {
nrmvideo = i<0x20 || radjust==0xdf;
linestate = 1;
linex = 5;
if (liney<ZX_VID_MARGIN) liney=ZX_VID_MARGIN;
} else if (linestate>=1) {
if (op&64) {
linestate = 0;
linex = ZX_VID_FULLWIDTH/8;
if (ramsize>=4 && !zx80) {
liney++;
lineyi=1;
}
} else {
linestate++;
linex++;
}
}
if (!nrmvideo) ulacharline = 0;
if((pc&0x8000) && !(op&64))
{
int x,y,v;
//do the ULA's char-generating stuff
x=linex;
y=liney;
//printf("ULA %3d,%3d = %02X\n",x,y,op);
if(y>=0 && y<ZX_VID_FULLHEIGHT && x>=0 && x<ZX_VID_FULLWIDTH/8)
{
//XXX I think this is what's needed for the `true hi-res'
//stuff from the ULA's side, but the timing is messed up
//at the moment so not worth it currently.
if (nrmvideo)
v=mem[((i&0xfe)<<8)|((op&63)<<3)|ulacharline];
else
v=mem[(i<<8)|(r&0x80)|(radjust&0x7f)];
//if(taguladisp) v^=128;
scrnbmp_new[y*(ZX_VID_FULLWIDTH/8)+x]=((op&128)?~v:v);
}
op=0; /* the CPU sees a nop */
}
pc++;
radjust++;
switch(op)
{
#include "z80ops.h"
}
if(tstates>=tsmax)
{
retval=1;
tstates-=tsmax;
linestart-=tsmax;
nextlinetime-=tsmax;
lastvsyncpend-=tsmax;
vsync_lasttoggle=vsync_toggle;
vsync_toggle=0;
frames++;
frame_pause();
}
/* the vsync length test is pretty arbitrary, because
* the timing isn't very accurate (more or less an instruction
* count) - but it's good enough in practice.
*
* the vsync_toggle test is fairly arbitrary too;
* there has to have been `not too many' for a TV to get
* confused. In practice, more than one would screw it up,
* but since we could be looking at over a frames' worth
* given where vsync_toggle is zeroed, we play it safe.
* also, we use a copy of the previous chunk's worth,
* since we need a full frame(-plus) to decide this.
*/
if(vsynclen && !vsync)
{
if(vsynclen>=10)
{
if(vsync_lasttoggle<=2)
{
vsyncpend=1; /* start of frame */
/* FAST mode screws up without this, but it's a bit
* unpleasant... :-/
*/
tstates=nextlinetime;
}
}
else
{
/* independent timing for this would be awkward, so
* anywhere on the line is good enough. Also,
* don't count it as a toggle.
*/
vsync_toggle--;
hsyncskip=1;
}
}
/* should do this all the time vsync is set */
if(vsync)
{
ulacharline=0;
vsynclen++;
}
else {
vsynclen=0;
}
if(tstates>=nextlinetime) /* new line */
{
/* generate fake sync if we haven't had one for a while;
* but if we just loaded/saved, wait for the first real frame instead
* to avoid jumpiness.
*/
if(!vsync && tstates-lastvsyncpend>=tsmax && !framewait)
vsyncpend=1;
/* but that won't ever happen if we always have vsync on -
* i.e., if we're grinding away in FAST mode. So for that
* case, we check for vsync being held for a full frame.
*/
if(vsync_visuals && vsynclen>=tsmax)
{
vsyncpend=1;
vsynclen=1;
goto postcopy; /* skip the usual copying */
}
if(!vsyncpend)
{
if (!lineyi) liney++;
if(hsyncgen && !hsyncskip)
{
ulacharline++;
ulacharline&=7;
}
}
else
{
bitbufBlit(scrnbmp_new);
postcopy:
memset(scrnbmp_new,0,sizeof(scrnbmp_new));
lastvsyncpend=tstates;
vsyncpend=0;
framewait=0;
liney=-1; /* XXX might be something up here */
}
if(nmigen)
nmipend=1;
hsyncskip=0;
linestart=nextlinetime;
nextlinetime+=linegap;
}
if(intsample && nmipend)
{
nmipend=0;
if(nmigen)
{
iff2=iff1;
iff1=0;
/* hardware syncs tstates to falling of NMI pulse (?),
* so a slight kludge here...
*/
if(fetch(pc&0x7fff)==0x76)
{
pc++;
tstates=linestart;
}
else
{
/* this seems curiously long, but equally, seems
* to be just about right. :-)
*/
tstates+=27;
}
push2(pc);
pc=0x66;
}
}
if(intsample && intpend)
{
intpend=0;
if(iff1)
{
if(fetch(pc&0x7fff)==0x76)pc++;
iff1=iff2=0;
tstates+=5; /* accompanied by an input from the data bus */
switch(im)
{
case 0: /* IM 0 */
case 1: /* undocumented */
case 2: /* IM 1 */
/* there is little to distinguish between these cases */
tstates+=9; /* perhaps */
push2(pc);
pc=0x38;
break;
case 3: /* IM 2 */
/* (seems unlikely it'd ever be used on the '81, but...) */
tstates+=13; /* perhaps */
{
int addr=fetch2((i<<8)|0xff);
push2(pc);
pc=addr;
}
}
}
}
/* this isn't used for any sort of Z80 interrupts,
* purely for the emulator's UI.
*/
if(interrupted)
{
if(interrupted==1)
{
do_interrupt(); /* also zeroes it */
}
else /* must be 2 */
{
/* a kludge to let us do a reset */
interrupted=0;
a=f=b=c=d=e=h=l=a1=f1=b1=c1=d1=e1=h1=l1=i=iff1=iff2=im=r=0;
ixoriy=new_ixoriy=0;
ix=iy=sp=pc=0;
tstates=radjust=0;
nextlinetime=linegap;
vsyncpend=vsynclen=0;
hsyncskip=0;
}
}
if (retval) break;
}
}
//void ResetZ80(void)
//{
// a=f=b=c=d=e=h=l=a1=f1=b1=c1=d1=e1=h1=l1=i=iff1=iff2=im=r=0;
// ixoriy=new_ixoriy=0;
// ix=iy=sp=pc=0;
// tstates=radjust=0;
// nextlinetime=linegap;
// tstates=0;
// frames=0;
// liney=0;
// vsy=0;
// linestart=0;
// vsync_toggle=0;
// vsync_lasttoggle=0;
//
// /* we load a snapshot, in effect.This does the registers.
// */
// if(autoload)
// {
// if (zx80) {
// /* Registers (common values) */
// a = 0x00; f = 0x44; b = 0x00; c = 0x00;
// d = 0x07; e = 0xae; h = 0x40; l = 0x2a;
// pc = 0x0283;
// ix = 0x0000; iy = 0x4000; i = 0x0e; r = 0xdd;
// a1 = 0x00; f1 = 0x00; b1 = 0x00; c1 = 0x21;
// d1 = 0xd8; e1 = 0xf0; h1 = 0xd8; l1 = 0xf0;
// iff1 = 0x00; iff2 = 0x00; im = 0x02;
// radjust = 0x6a;
// /* Machine Stack (common values) */
// if (ramsize >= 16) {
// sp = 0x8000 - 4;
// } else {
// sp = 0x4000 - 4 + ramsize * 1024;
// }
// mem[sp + 0] = 0x47;
// mem[sp + 1] = 0x04;
// mem[sp + 2] = 0xba;
// mem[sp + 3] = 0x3f;
// /* Now override if RAM configuration changes things
// * (there's a possibility these changes are unimportant) */
// if (ramsize == 16) {
// mem[sp + 2] = 0x22;
// }
// } else {
// static unsigned char bit1[9]={0xFF,0x80,0xFC,0x7F,0x00,0x80,0x00,0xFE,0xFF};
// static unsigned char bit2[4]={0x76,0x06,0x00,0x3e};
//
// /* memory will already be zeroed at this point */
//
// memcpy(mem+0x4000,bit1,9);
// memcpy(mem+0x7ffc,bit2,4);
//
// a=0x0B; f=0x85; b=0x00; c=0xFF;
// d=0x43; e=0x99; h=0xC3; l=0x99;
// a1=0xE2; f1=0xA1; b1=0x81; c1=0x02;
// d1=0x00; e1=0x2B; h1=0x00; l1=0x00;
// i=0x1E; iff1=iff2=0;
// im=2;
// r=0xDD; radjust=0xCA;
// ix=0x281; iy=0x4000;
// sp=0x7FFC;
// pc=0x207;
// }
//
//
// /* finally, load. It'll reset (via reset81) if it fails. */
// load_p(32768);
//
// /* wait for a real frame, to avoid an annoying frame `jump'. */
// framewait=1;
// }
//}
void ResetZ80_Flash(unsigned char id)
{
a=f=b=c=d=e=h=l=a1=f1=b1=c1=d1=e1=h1=l1=i=iff1=iff2=im=r=0;
ixoriy=new_ixoriy=0;
ix=iy=sp=pc=0;
tstates=radjust=0;
nextlinetime=linegap;
tstates=0;
frames=0;
liney=0;
vsy=0;
linestart=0;
vsync_toggle=0;
vsync_lasttoggle=0;
/* we load a snapshot, in effect.This does the registers.
*/
if(autoload)
{
if (zx80) {
/* Registers (common values) */
a = 0x00; f = 0x44; b = 0x00; c = 0x00;
d = 0x07; e = 0xae; h = 0x40; l = 0x2a;
pc = 0x0283;
ix = 0x0000; iy = 0x4000; i = 0x0e; r = 0xdd;
a1 = 0x00; f1 = 0x00; b1 = 0x00; c1 = 0x21;
d1 = 0xd8; e1 = 0xf0; h1 = 0xd8; l1 = 0xf0;
iff1 = 0x00; iff2 = 0x00; im = 0x02;
radjust = 0x6a;
/* Machine Stack (common values) */
if (ramsize >= 16) {
sp = 0x8000 - 4;
} else {
sp = 0x4000 - 4 + ramsize * 1024;
}
mem[sp + 0] = 0x47;
mem[sp + 1] = 0x04;
mem[sp + 2] = 0xba;
mem[sp + 3] = 0x3f;
/* Now override if RAM configuration changes things
* (there's a possibility these changes are unimportant) */
if (ramsize == 16) {
mem[sp + 2] = 0x22;
}
} else {
static unsigned char bit1[9]={0xFF,0x80,0xFC,0x7F,0x00,0x80,0x00,0xFE,0xFF};
static unsigned char bit2[4]={0x76,0x06,0x00,0x3e};
/* memory will already be zeroed at this point */
memcpy(mem+0x4000,bit1,9);
memcpy(mem+0x7ffc,bit2,4);
a=0x0B; f=0x85; b=0x00; c=0xFF;
d=0x43; e=0x99; h=0xC3; l=0x99;
a1=0xE2; f1=0xA1; b1=0x81; c1=0x02;
d1=0x00; e1=0x2B; h1=0x00; l1=0x00;
i=0x1E; iff1=iff2=0;
im=2;
r=0xDD; radjust=0xCA;
ix=0x281; iy=0x4000;
sp=0x7FFC;
pc=0x207;
}
/* finally, load. It'll reset (via reset81) if it fails. */
load_p_flash(32768,id);
/* wait for a real frame, to avoid an annoying frame `jump'. */
framewait=1;
}
}
|
_grep: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
}
}
int
main(int argc, char *argv[])
{
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 57 push %edi
4: 56 push %esi
5: 53 push %ebx
6: 83 e4 f0 and $0xfffffff0,%esp
9: 83 ec 10 sub $0x10,%esp
c: 8b 5d 0c mov 0xc(%ebp),%ebx
int fd, i;
char *pattern;
if(argc <= 1){
f: 83 7d 08 01 cmpl $0x1,0x8(%ebp)
13: 0f 8e 8b 00 00 00 jle a4 <main+0xa4>
printf(2, "usage: grep pattern [file ...]\n");
exit();
}
pattern = argv[1];
19: 8b 43 04 mov 0x4(%ebx),%eax
1c: 83 c3 08 add $0x8,%ebx
if(argc <= 2){
1f: be 02 00 00 00 mov $0x2,%esi
24: 83 7d 08 02 cmpl $0x2,0x8(%ebp)
if(argc <= 1){
printf(2, "usage: grep pattern [file ...]\n");
exit();
}
pattern = argv[1];
28: 89 44 24 0c mov %eax,0xc(%esp)
if(argc <= 2){
2c: 74 61 je 8f <main+0x8f>
2e: 66 90 xchg %ax,%ax
grep(pattern, 0);
exit();
}
for(i = 2; i < argc; i++){
if((fd = open(argv[i], 0)) < 0){
30: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
37: 00
38: 8b 03 mov (%ebx),%eax
3a: 89 04 24 mov %eax,(%esp)
3d: e8 30 05 00 00 call 572 <open>
42: 85 c0 test %eax,%eax
44: 89 c7 mov %eax,%edi
46: 78 28 js 70 <main+0x70>
printf(1, "grep: cannot open %s\n", argv[i]);
exit();
}
grep(pattern, fd);
48: 89 44 24 04 mov %eax,0x4(%esp)
4c: 8b 44 24 0c mov 0xc(%esp),%eax
if(argc <= 2){
grep(pattern, 0);
exit();
}
for(i = 2; i < argc; i++){
50: 83 c6 01 add $0x1,%esi
53: 83 c3 04 add $0x4,%ebx
if((fd = open(argv[i], 0)) < 0){
printf(1, "grep: cannot open %s\n", argv[i]);
exit();
}
grep(pattern, fd);
56: 89 04 24 mov %eax,(%esp)
59: e8 a2 01 00 00 call 200 <grep>
close(fd);
5e: 89 3c 24 mov %edi,(%esp)
61: e8 f4 04 00 00 call 55a <close>
if(argc <= 2){
grep(pattern, 0);
exit();
}
for(i = 2; i < argc; i++){
66: 39 75 08 cmp %esi,0x8(%ebp)
69: 7f c5 jg 30 <main+0x30>
exit();
}
grep(pattern, fd);
close(fd);
}
exit();
6b: e8 c2 04 00 00 call 532 <exit>
exit();
}
for(i = 2; i < argc; i++){
if((fd = open(argv[i], 0)) < 0){
printf(1, "grep: cannot open %s\n", argv[i]);
70: 8b 03 mov (%ebx),%eax
72: c7 44 24 04 18 0a 00 movl $0xa18,0x4(%esp)
79: 00
7a: c7 04 24 01 00 00 00 movl $0x1,(%esp)
81: 89 44 24 08 mov %eax,0x8(%esp)
85: e8 06 06 00 00 call 690 <printf>
exit();
8a: e8 a3 04 00 00 call 532 <exit>
exit();
}
pattern = argv[1];
if(argc <= 2){
grep(pattern, 0);
8f: 89 04 24 mov %eax,(%esp)
92: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
99: 00
9a: e8 61 01 00 00 call 200 <grep>
exit();
9f: e8 8e 04 00 00 call 532 <exit>
{
int fd, i;
char *pattern;
if(argc <= 1){
printf(2, "usage: grep pattern [file ...]\n");
a4: c7 44 24 04 f8 09 00 movl $0x9f8,0x4(%esp)
ab: 00
ac: c7 04 24 02 00 00 00 movl $0x2,(%esp)
b3: e8 d8 05 00 00 call 690 <printf>
exit();
b8: e8 75 04 00 00 call 532 <exit>
bd: 66 90 xchg %ax,%ax
bf: 90 nop
000000c0 <matchstar>:
return 0;
}
// matchstar: search for c*re at beginning of text
int matchstar(int c, char *re, char *text)
{
c0: 55 push %ebp
c1: 89 e5 mov %esp,%ebp
c3: 57 push %edi
c4: 56 push %esi
c5: 53 push %ebx
c6: 83 ec 1c sub $0x1c,%esp
c9: 8b 75 08 mov 0x8(%ebp),%esi
cc: 8b 7d 0c mov 0xc(%ebp),%edi
cf: 8b 5d 10 mov 0x10(%ebp),%ebx
d2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
do{ // a * matches zero or more instances
if(matchhere(re, text))
d8: 89 5c 24 04 mov %ebx,0x4(%esp)
dc: 89 3c 24 mov %edi,(%esp)
df: e8 3c 00 00 00 call 120 <matchhere>
e4: 85 c0 test %eax,%eax
e6: 75 20 jne 108 <matchstar+0x48>
return 1;
}while(*text!='\0' && (*text++==c || c=='.'));
e8: 0f be 13 movsbl (%ebx),%edx
eb: 84 d2 test %dl,%dl
ed: 74 0c je fb <matchstar+0x3b>
ef: 83 c3 01 add $0x1,%ebx
f2: 39 f2 cmp %esi,%edx
f4: 74 e2 je d8 <matchstar+0x18>
f6: 83 fe 2e cmp $0x2e,%esi
f9: 74 dd je d8 <matchstar+0x18>
return 0;
}
fb: 83 c4 1c add $0x1c,%esp
fe: 5b pop %ebx
ff: 5e pop %esi
100: 5f pop %edi
101: 5d pop %ebp
102: c3 ret
103: 90 nop
104: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
108: 83 c4 1c add $0x1c,%esp
// matchstar: search for c*re at beginning of text
int matchstar(int c, char *re, char *text)
{
do{ // a * matches zero or more instances
if(matchhere(re, text))
return 1;
10b: b8 01 00 00 00 mov $0x1,%eax
}while(*text!='\0' && (*text++==c || c=='.'));
return 0;
}
110: 5b pop %ebx
111: 5e pop %esi
112: 5f pop %edi
113: 5d pop %ebp
114: c3 ret
115: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
119: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000120 <matchhere>:
return 0;
}
// matchhere: search for re at beginning of text
int matchhere(char *re, char *text)
{
120: 55 push %ebp
121: 89 e5 mov %esp,%ebp
123: 53 push %ebx
124: 83 ec 14 sub $0x14,%esp
127: 8b 55 08 mov 0x8(%ebp),%edx
12a: 8b 4d 0c mov 0xc(%ebp),%ecx
if(re[0] == '\0')
12d: 0f be 02 movsbl (%edx),%eax
130: 84 c0 test %al,%al
132: 75 20 jne 154 <matchhere+0x34>
134: eb 42 jmp 178 <matchhere+0x58>
136: 66 90 xchg %ax,%ax
return 1;
if(re[1] == '*')
return matchstar(re[0], re+2, text);
if(re[0] == '$' && re[1] == '\0')
return *text == '\0';
if(*text!='\0' && (re[0]=='.' || re[0]==*text))
138: 0f b6 19 movzbl (%ecx),%ebx
13b: 84 db test %bl,%bl
13d: 74 31 je 170 <matchhere+0x50>
13f: 3c 2e cmp $0x2e,%al
141: 74 04 je 147 <matchhere+0x27>
143: 38 d8 cmp %bl,%al
145: 75 29 jne 170 <matchhere+0x50>
return matchhere(re+1, text+1);
147: 83 c2 01 add $0x1,%edx
}
// matchhere: search for re at beginning of text
int matchhere(char *re, char *text)
{
if(re[0] == '\0')
14a: 0f be 02 movsbl (%edx),%eax
if(re[1] == '*')
return matchstar(re[0], re+2, text);
if(re[0] == '$' && re[1] == '\0')
return *text == '\0';
if(*text!='\0' && (re[0]=='.' || re[0]==*text))
return matchhere(re+1, text+1);
14d: 83 c1 01 add $0x1,%ecx
}
// matchhere: search for re at beginning of text
int matchhere(char *re, char *text)
{
if(re[0] == '\0')
150: 84 c0 test %al,%al
152: 74 24 je 178 <matchhere+0x58>
return 1;
if(re[1] == '*')
154: 0f b6 5a 01 movzbl 0x1(%edx),%ebx
158: 80 fb 2a cmp $0x2a,%bl
15b: 74 2b je 188 <matchhere+0x68>
return matchstar(re[0], re+2, text);
if(re[0] == '$' && re[1] == '\0')
15d: 3c 24 cmp $0x24,%al
15f: 75 d7 jne 138 <matchhere+0x18>
161: 84 db test %bl,%bl
163: 74 3c je 1a1 <matchhere+0x81>
return *text == '\0';
if(*text!='\0' && (re[0]=='.' || re[0]==*text))
165: 0f b6 19 movzbl (%ecx),%ebx
168: 84 db test %bl,%bl
16a: 75 d7 jne 143 <matchhere+0x23>
16c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
return matchhere(re+1, text+1);
return 0;
170: 31 c0 xor %eax,%eax
}
172: 83 c4 14 add $0x14,%esp
175: 5b pop %ebx
176: 5d pop %ebp
177: c3 ret
178: 83 c4 14 add $0x14,%esp
// matchhere: search for re at beginning of text
int matchhere(char *re, char *text)
{
if(re[0] == '\0')
return 1;
17b: b8 01 00 00 00 mov $0x1,%eax
if(re[0] == '$' && re[1] == '\0')
return *text == '\0';
if(*text!='\0' && (re[0]=='.' || re[0]==*text))
return matchhere(re+1, text+1);
return 0;
}
180: 5b pop %ebx
181: 5d pop %ebp
182: c3 ret
183: 90 nop
184: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
int matchhere(char *re, char *text)
{
if(re[0] == '\0')
return 1;
if(re[1] == '*')
return matchstar(re[0], re+2, text);
188: 83 c2 02 add $0x2,%edx
18b: 89 4c 24 08 mov %ecx,0x8(%esp)
18f: 89 54 24 04 mov %edx,0x4(%esp)
193: 89 04 24 mov %eax,(%esp)
196: e8 25 ff ff ff call c0 <matchstar>
if(re[0] == '$' && re[1] == '\0')
return *text == '\0';
if(*text!='\0' && (re[0]=='.' || re[0]==*text))
return matchhere(re+1, text+1);
return 0;
}
19b: 83 c4 14 add $0x14,%esp
19e: 5b pop %ebx
19f: 5d pop %ebp
1a0: c3 ret
if(re[0] == '\0')
return 1;
if(re[1] == '*')
return matchstar(re[0], re+2, text);
if(re[0] == '$' && re[1] == '\0')
return *text == '\0';
1a1: 31 c0 xor %eax,%eax
1a3: 80 39 00 cmpb $0x0,(%ecx)
1a6: 0f 94 c0 sete %al
1a9: eb c7 jmp 172 <matchhere+0x52>
1ab: 90 nop
1ac: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
000001b0 <match>:
int matchhere(char*, char*);
int matchstar(int, char*, char*);
int
match(char *re, char *text)
{
1b0: 55 push %ebp
1b1: 89 e5 mov %esp,%ebp
1b3: 56 push %esi
1b4: 53 push %ebx
1b5: 83 ec 10 sub $0x10,%esp
1b8: 8b 75 08 mov 0x8(%ebp),%esi
1bb: 8b 5d 0c mov 0xc(%ebp),%ebx
if(re[0] == '^')
1be: 80 3e 5e cmpb $0x5e,(%esi)
1c1: 75 0e jne 1d1 <match+0x21>
1c3: eb 28 jmp 1ed <match+0x3d>
1c5: 8d 76 00 lea 0x0(%esi),%esi
return matchhere(re+1, text);
do{ // must look at empty string
if(matchhere(re, text))
return 1;
}while(*text++ != '\0');
1c8: 83 c3 01 add $0x1,%ebx
1cb: 80 7b ff 00 cmpb $0x0,-0x1(%ebx)
1cf: 74 15 je 1e6 <match+0x36>
match(char *re, char *text)
{
if(re[0] == '^')
return matchhere(re+1, text);
do{ // must look at empty string
if(matchhere(re, text))
1d1: 89 5c 24 04 mov %ebx,0x4(%esp)
1d5: 89 34 24 mov %esi,(%esp)
1d8: e8 43 ff ff ff call 120 <matchhere>
1dd: 85 c0 test %eax,%eax
1df: 74 e7 je 1c8 <match+0x18>
return 1;
1e1: b8 01 00 00 00 mov $0x1,%eax
}while(*text++ != '\0');
return 0;
}
1e6: 83 c4 10 add $0x10,%esp
1e9: 5b pop %ebx
1ea: 5e pop %esi
1eb: 5d pop %ebp
1ec: c3 ret
int
match(char *re, char *text)
{
if(re[0] == '^')
return matchhere(re+1, text);
1ed: 83 c6 01 add $0x1,%esi
1f0: 89 75 08 mov %esi,0x8(%ebp)
do{ // must look at empty string
if(matchhere(re, text))
return 1;
}while(*text++ != '\0');
return 0;
}
1f3: 83 c4 10 add $0x10,%esp
1f6: 5b pop %ebx
1f7: 5e pop %esi
1f8: 5d pop %ebp
int
match(char *re, char *text)
{
if(re[0] == '^')
return matchhere(re+1, text);
1f9: e9 22 ff ff ff jmp 120 <matchhere>
1fe: 66 90 xchg %ax,%ax
00000200 <grep>:
char buf[1024];
int match(char*, char*);
void
grep(char *pattern, int fd)
{
200: 55 push %ebp
201: 89 e5 mov %esp,%ebp
203: 57 push %edi
204: 56 push %esi
205: 53 push %ebx
206: 83 ec 1c sub $0x1c,%esp
209: 8b 75 08 mov 0x8(%ebp),%esi
int n, m;
char *p, *q;
m = 0;
20c: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp)
213: 90 nop
214: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
while((n = read(fd, buf+m, sizeof(buf)-m-1)) > 0){
218: 8b 55 e4 mov -0x1c(%ebp),%edx
21b: b8 ff 03 00 00 mov $0x3ff,%eax
220: 29 d0 sub %edx,%eax
222: 89 44 24 08 mov %eax,0x8(%esp)
226: 89 d0 mov %edx,%eax
228: 05 c0 0d 00 00 add $0xdc0,%eax
22d: 89 44 24 04 mov %eax,0x4(%esp)
231: 8b 45 0c mov 0xc(%ebp),%eax
234: 89 04 24 mov %eax,(%esp)
237: e8 0e 03 00 00 call 54a <read>
23c: 85 c0 test %eax,%eax
23e: 0f 8e b8 00 00 00 jle 2fc <grep+0xfc>
m += n;
244: 01 45 e4 add %eax,-0x1c(%ebp)
buf[m] = '\0';
p = buf;
247: bb c0 0d 00 00 mov $0xdc0,%ebx
char *p, *q;
m = 0;
while((n = read(fd, buf+m, sizeof(buf)-m-1)) > 0){
m += n;
buf[m] = '\0';
24c: 8b 45 e4 mov -0x1c(%ebp),%eax
24f: c6 80 c0 0d 00 00 00 movb $0x0,0xdc0(%eax)
256: 66 90 xchg %ax,%ax
p = buf;
while((q = strchr(p, '\n')) != 0){
258: c7 44 24 04 0a 00 00 movl $0xa,0x4(%esp)
25f: 00
260: 89 1c 24 mov %ebx,(%esp)
263: e8 78 01 00 00 call 3e0 <strchr>
268: 85 c0 test %eax,%eax
26a: 89 c7 mov %eax,%edi
26c: 74 42 je 2b0 <grep+0xb0>
*q = 0;
26e: c6 07 00 movb $0x0,(%edi)
if(match(pattern, p)){
271: 89 5c 24 04 mov %ebx,0x4(%esp)
275: 89 34 24 mov %esi,(%esp)
278: e8 33 ff ff ff call 1b0 <match>
27d: 85 c0 test %eax,%eax
27f: 75 07 jne 288 <grep+0x88>
281: 8d 5f 01 lea 0x1(%edi),%ebx
284: eb d2 jmp 258 <grep+0x58>
286: 66 90 xchg %ax,%ax
*q = '\n';
288: c6 07 0a movb $0xa,(%edi)
write(1, p, q+1 - p);
28b: 83 c7 01 add $0x1,%edi
28e: 89 f8 mov %edi,%eax
290: 29 d8 sub %ebx,%eax
292: 89 5c 24 04 mov %ebx,0x4(%esp)
296: 89 fb mov %edi,%ebx
298: 89 44 24 08 mov %eax,0x8(%esp)
29c: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2a3: e8 aa 02 00 00 call 552 <write>
2a8: eb ae jmp 258 <grep+0x58>
2aa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
}
p = q+1;
}
if(p == buf)
2b0: 81 fb c0 0d 00 00 cmp $0xdc0,%ebx
2b6: 74 38 je 2f0 <grep+0xf0>
m = 0;
if(m > 0){
2b8: 8b 45 e4 mov -0x1c(%ebp),%eax
2bb: 85 c0 test %eax,%eax
2bd: 0f 8e 55 ff ff ff jle 218 <grep+0x18>
m -= p - buf;
2c3: b8 c0 0d 00 00 mov $0xdc0,%eax
2c8: 29 d8 sub %ebx,%eax
2ca: 01 45 e4 add %eax,-0x1c(%ebp)
memmove(buf, p, m);
2cd: 8b 45 e4 mov -0x1c(%ebp),%eax
2d0: 89 5c 24 04 mov %ebx,0x4(%esp)
2d4: c7 04 24 c0 0d 00 00 movl $0xdc0,(%esp)
2db: 89 44 24 08 mov %eax,0x8(%esp)
2df: e8 1c 02 00 00 call 500 <memmove>
2e4: e9 2f ff ff ff jmp 218 <grep+0x18>
2e9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
write(1, p, q+1 - p);
}
p = q+1;
}
if(p == buf)
m = 0;
2f0: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp)
2f7: e9 1c ff ff ff jmp 218 <grep+0x18>
if(m > 0){
m -= p - buf;
memmove(buf, p, m);
}
}
}
2fc: 83 c4 1c add $0x1c,%esp
2ff: 5b pop %ebx
300: 5e pop %esi
301: 5f pop %edi
302: 5d pop %ebp
303: c3 ret
304: 66 90 xchg %ax,%ax
306: 66 90 xchg %ax,%ax
308: 66 90 xchg %ax,%ax
30a: 66 90 xchg %ax,%ax
30c: 66 90 xchg %ax,%ax
30e: 66 90 xchg %ax,%ax
00000310 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, const char *t)
{
310: 55 push %ebp
311: 89 e5 mov %esp,%ebp
313: 8b 45 08 mov 0x8(%ebp),%eax
316: 8b 4d 0c mov 0xc(%ebp),%ecx
319: 53 push %ebx
char *os;
os = s;
while((*s++ = *t++) != 0)
31a: 89 c2 mov %eax,%edx
31c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
320: 83 c1 01 add $0x1,%ecx
323: 0f b6 59 ff movzbl -0x1(%ecx),%ebx
327: 83 c2 01 add $0x1,%edx
32a: 84 db test %bl,%bl
32c: 88 5a ff mov %bl,-0x1(%edx)
32f: 75 ef jne 320 <strcpy+0x10>
;
return os;
}
331: 5b pop %ebx
332: 5d pop %ebp
333: c3 ret
334: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
33a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
00000340 <strcmp>:
int
strcmp(const char *p, const char *q)
{
340: 55 push %ebp
341: 89 e5 mov %esp,%ebp
343: 8b 55 08 mov 0x8(%ebp),%edx
346: 53 push %ebx
347: 8b 4d 0c mov 0xc(%ebp),%ecx
while(*p && *p == *q)
34a: 0f b6 02 movzbl (%edx),%eax
34d: 84 c0 test %al,%al
34f: 74 2d je 37e <strcmp+0x3e>
351: 0f b6 19 movzbl (%ecx),%ebx
354: 38 d8 cmp %bl,%al
356: 74 0e je 366 <strcmp+0x26>
358: eb 2b jmp 385 <strcmp+0x45>
35a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
360: 38 c8 cmp %cl,%al
362: 75 15 jne 379 <strcmp+0x39>
p++, q++;
364: 89 d9 mov %ebx,%ecx
366: 83 c2 01 add $0x1,%edx
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
369: 0f b6 02 movzbl (%edx),%eax
p++, q++;
36c: 8d 59 01 lea 0x1(%ecx),%ebx
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
36f: 0f b6 49 01 movzbl 0x1(%ecx),%ecx
373: 84 c0 test %al,%al
375: 75 e9 jne 360 <strcmp+0x20>
377: 31 c0 xor %eax,%eax
p++, q++;
return (uchar)*p - (uchar)*q;
379: 29 c8 sub %ecx,%eax
}
37b: 5b pop %ebx
37c: 5d pop %ebp
37d: c3 ret
37e: 0f b6 09 movzbl (%ecx),%ecx
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
381: 31 c0 xor %eax,%eax
383: eb f4 jmp 379 <strcmp+0x39>
385: 0f b6 cb movzbl %bl,%ecx
388: eb ef jmp 379 <strcmp+0x39>
38a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
00000390 <strlen>:
return (uchar)*p - (uchar)*q;
}
uint
strlen(const char *s)
{
390: 55 push %ebp
391: 89 e5 mov %esp,%ebp
393: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
for(n = 0; s[n]; n++)
396: 80 39 00 cmpb $0x0,(%ecx)
399: 74 12 je 3ad <strlen+0x1d>
39b: 31 d2 xor %edx,%edx
39d: 8d 76 00 lea 0x0(%esi),%esi
3a0: 83 c2 01 add $0x1,%edx
3a3: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1)
3a7: 89 d0 mov %edx,%eax
3a9: 75 f5 jne 3a0 <strlen+0x10>
;
return n;
}
3ab: 5d pop %ebp
3ac: c3 ret
uint
strlen(const char *s)
{
int n;
for(n = 0; s[n]; n++)
3ad: 31 c0 xor %eax,%eax
;
return n;
}
3af: 5d pop %ebp
3b0: c3 ret
3b1: eb 0d jmp 3c0 <memset>
3b3: 90 nop
3b4: 90 nop
3b5: 90 nop
3b6: 90 nop
3b7: 90 nop
3b8: 90 nop
3b9: 90 nop
3ba: 90 nop
3bb: 90 nop
3bc: 90 nop
3bd: 90 nop
3be: 90 nop
3bf: 90 nop
000003c0 <memset>:
void*
memset(void *dst, int c, uint n)
{
3c0: 55 push %ebp
3c1: 89 e5 mov %esp,%ebp
3c3: 8b 55 08 mov 0x8(%ebp),%edx
3c6: 57 push %edi
}
static inline void
stosb(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosb" :
3c7: 8b 4d 10 mov 0x10(%ebp),%ecx
3ca: 8b 45 0c mov 0xc(%ebp),%eax
3cd: 89 d7 mov %edx,%edi
3cf: fc cld
3d0: f3 aa rep stos %al,%es:(%edi)
stosb(dst, c, n);
return dst;
}
3d2: 89 d0 mov %edx,%eax
3d4: 5f pop %edi
3d5: 5d pop %ebp
3d6: c3 ret
3d7: 89 f6 mov %esi,%esi
3d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000003e0 <strchr>:
char*
strchr(const char *s, char c)
{
3e0: 55 push %ebp
3e1: 89 e5 mov %esp,%ebp
3e3: 8b 45 08 mov 0x8(%ebp),%eax
3e6: 53 push %ebx
3e7: 8b 55 0c mov 0xc(%ebp),%edx
for(; *s; s++)
3ea: 0f b6 18 movzbl (%eax),%ebx
3ed: 84 db test %bl,%bl
3ef: 74 1d je 40e <strchr+0x2e>
if(*s == c)
3f1: 38 d3 cmp %dl,%bl
3f3: 89 d1 mov %edx,%ecx
3f5: 75 0d jne 404 <strchr+0x24>
3f7: eb 17 jmp 410 <strchr+0x30>
3f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
400: 38 ca cmp %cl,%dl
402: 74 0c je 410 <strchr+0x30>
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
404: 83 c0 01 add $0x1,%eax
407: 0f b6 10 movzbl (%eax),%edx
40a: 84 d2 test %dl,%dl
40c: 75 f2 jne 400 <strchr+0x20>
if(*s == c)
return (char*)s;
return 0;
40e: 31 c0 xor %eax,%eax
}
410: 5b pop %ebx
411: 5d pop %ebp
412: c3 ret
413: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
419: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000420 <gets>:
char*
gets(char *buf, int max)
{
420: 55 push %ebp
421: 89 e5 mov %esp,%ebp
423: 57 push %edi
424: 56 push %esi
int i, cc;
char c;
for(i=0; i+1 < max; ){
425: 31 f6 xor %esi,%esi
return 0;
}
char*
gets(char *buf, int max)
{
427: 53 push %ebx
428: 83 ec 2c sub $0x2c,%esp
int i, cc;
char c;
for(i=0; i+1 < max; ){
cc = read(0, &c, 1);
42b: 8d 7d e7 lea -0x19(%ebp),%edi
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
42e: eb 31 jmp 461 <gets+0x41>
cc = read(0, &c, 1);
430: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
437: 00
438: 89 7c 24 04 mov %edi,0x4(%esp)
43c: c7 04 24 00 00 00 00 movl $0x0,(%esp)
443: e8 02 01 00 00 call 54a <read>
if(cc < 1)
448: 85 c0 test %eax,%eax
44a: 7e 1d jle 469 <gets+0x49>
break;
buf[i++] = c;
44c: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
450: 89 de mov %ebx,%esi
cc = read(0, &c, 1);
if(cc < 1)
break;
buf[i++] = c;
452: 8b 55 08 mov 0x8(%ebp),%edx
if(c == '\n' || c == '\r')
455: 3c 0d cmp $0xd,%al
for(i=0; i+1 < max; ){
cc = read(0, &c, 1);
if(cc < 1)
break;
buf[i++] = c;
457: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1)
if(c == '\n' || c == '\r')
45b: 74 0c je 469 <gets+0x49>
45d: 3c 0a cmp $0xa,%al
45f: 74 08 je 469 <gets+0x49>
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
461: 8d 5e 01 lea 0x1(%esi),%ebx
464: 3b 5d 0c cmp 0xc(%ebp),%ebx
467: 7c c7 jl 430 <gets+0x10>
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
469: 8b 45 08 mov 0x8(%ebp),%eax
46c: c6 04 30 00 movb $0x0,(%eax,%esi,1)
return buf;
}
470: 83 c4 2c add $0x2c,%esp
473: 5b pop %ebx
474: 5e pop %esi
475: 5f pop %edi
476: 5d pop %ebp
477: c3 ret
478: 90 nop
479: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000480 <stat>:
int
stat(const char *n, struct stat *st)
{
480: 55 push %ebp
481: 89 e5 mov %esp,%ebp
483: 56 push %esi
484: 53 push %ebx
485: 83 ec 10 sub $0x10,%esp
int fd;
int r;
fd = open(n, O_RDONLY);
488: 8b 45 08 mov 0x8(%ebp),%eax
48b: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
492: 00
493: 89 04 24 mov %eax,(%esp)
496: e8 d7 00 00 00 call 572 <open>
if(fd < 0)
49b: 85 c0 test %eax,%eax
stat(const char *n, struct stat *st)
{
int fd;
int r;
fd = open(n, O_RDONLY);
49d: 89 c3 mov %eax,%ebx
if(fd < 0)
49f: 78 27 js 4c8 <stat+0x48>
return -1;
r = fstat(fd, st);
4a1: 8b 45 0c mov 0xc(%ebp),%eax
4a4: 89 1c 24 mov %ebx,(%esp)
4a7: 89 44 24 04 mov %eax,0x4(%esp)
4ab: e8 da 00 00 00 call 58a <fstat>
close(fd);
4b0: 89 1c 24 mov %ebx,(%esp)
int r;
fd = open(n, O_RDONLY);
if(fd < 0)
return -1;
r = fstat(fd, st);
4b3: 89 c6 mov %eax,%esi
close(fd);
4b5: e8 a0 00 00 00 call 55a <close>
return r;
4ba: 89 f0 mov %esi,%eax
}
4bc: 83 c4 10 add $0x10,%esp
4bf: 5b pop %ebx
4c0: 5e pop %esi
4c1: 5d pop %ebp
4c2: c3 ret
4c3: 90 nop
4c4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
int fd;
int r;
fd = open(n, O_RDONLY);
if(fd < 0)
return -1;
4c8: b8 ff ff ff ff mov $0xffffffff,%eax
4cd: eb ed jmp 4bc <stat+0x3c>
4cf: 90 nop
000004d0 <atoi>:
return r;
}
int
atoi(const char *s)
{
4d0: 55 push %ebp
4d1: 89 e5 mov %esp,%ebp
4d3: 8b 4d 08 mov 0x8(%ebp),%ecx
4d6: 53 push %ebx
int n;
n = 0;
while('0' <= *s && *s <= '9')
4d7: 0f be 11 movsbl (%ecx),%edx
4da: 8d 42 d0 lea -0x30(%edx),%eax
4dd: 3c 09 cmp $0x9,%al
int
atoi(const char *s)
{
int n;
n = 0;
4df: b8 00 00 00 00 mov $0x0,%eax
while('0' <= *s && *s <= '9')
4e4: 77 17 ja 4fd <atoi+0x2d>
4e6: 66 90 xchg %ax,%ax
n = n*10 + *s++ - '0';
4e8: 83 c1 01 add $0x1,%ecx
4eb: 8d 04 80 lea (%eax,%eax,4),%eax
4ee: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax
atoi(const char *s)
{
int n;
n = 0;
while('0' <= *s && *s <= '9')
4f2: 0f be 11 movsbl (%ecx),%edx
4f5: 8d 5a d0 lea -0x30(%edx),%ebx
4f8: 80 fb 09 cmp $0x9,%bl
4fb: 76 eb jbe 4e8 <atoi+0x18>
n = n*10 + *s++ - '0';
return n;
}
4fd: 5b pop %ebx
4fe: 5d pop %ebp
4ff: c3 ret
00000500 <memmove>:
void*
memmove(void *vdst, const void *vsrc, int n)
{
500: 55 push %ebp
char *dst;
const char *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
501: 31 d2 xor %edx,%edx
return n;
}
void*
memmove(void *vdst, const void *vsrc, int n)
{
503: 89 e5 mov %esp,%ebp
505: 56 push %esi
506: 8b 45 08 mov 0x8(%ebp),%eax
509: 53 push %ebx
50a: 8b 5d 10 mov 0x10(%ebp),%ebx
50d: 8b 75 0c mov 0xc(%ebp),%esi
char *dst;
const char *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
510: 85 db test %ebx,%ebx
512: 7e 12 jle 526 <memmove+0x26>
514: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
*dst++ = *src++;
518: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx
51c: 88 0c 10 mov %cl,(%eax,%edx,1)
51f: 83 c2 01 add $0x1,%edx
char *dst;
const char *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
522: 39 da cmp %ebx,%edx
524: 75 f2 jne 518 <memmove+0x18>
*dst++ = *src++;
return vdst;
}
526: 5b pop %ebx
527: 5e pop %esi
528: 5d pop %ebp
529: c3 ret
0000052a <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
52a: b8 01 00 00 00 mov $0x1,%eax
52f: cd 40 int $0x40
531: c3 ret
00000532 <exit>:
SYSCALL(exit)
532: b8 02 00 00 00 mov $0x2,%eax
537: cd 40 int $0x40
539: c3 ret
0000053a <wait>:
SYSCALL(wait)
53a: b8 03 00 00 00 mov $0x3,%eax
53f: cd 40 int $0x40
541: c3 ret
00000542 <pipe>:
SYSCALL(pipe)
542: b8 04 00 00 00 mov $0x4,%eax
547: cd 40 int $0x40
549: c3 ret
0000054a <read>:
SYSCALL(read)
54a: b8 05 00 00 00 mov $0x5,%eax
54f: cd 40 int $0x40
551: c3 ret
00000552 <write>:
SYSCALL(write)
552: b8 10 00 00 00 mov $0x10,%eax
557: cd 40 int $0x40
559: c3 ret
0000055a <close>:
SYSCALL(close)
55a: b8 15 00 00 00 mov $0x15,%eax
55f: cd 40 int $0x40
561: c3 ret
00000562 <kill>:
SYSCALL(kill)
562: b8 06 00 00 00 mov $0x6,%eax
567: cd 40 int $0x40
569: c3 ret
0000056a <exec>:
SYSCALL(exec)
56a: b8 07 00 00 00 mov $0x7,%eax
56f: cd 40 int $0x40
571: c3 ret
00000572 <open>:
SYSCALL(open)
572: b8 0f 00 00 00 mov $0xf,%eax
577: cd 40 int $0x40
579: c3 ret
0000057a <mknod>:
SYSCALL(mknod)
57a: b8 11 00 00 00 mov $0x11,%eax
57f: cd 40 int $0x40
581: c3 ret
00000582 <unlink>:
SYSCALL(unlink)
582: b8 12 00 00 00 mov $0x12,%eax
587: cd 40 int $0x40
589: c3 ret
0000058a <fstat>:
SYSCALL(fstat)
58a: b8 08 00 00 00 mov $0x8,%eax
58f: cd 40 int $0x40
591: c3 ret
00000592 <link>:
SYSCALL(link)
592: b8 13 00 00 00 mov $0x13,%eax
597: cd 40 int $0x40
599: c3 ret
0000059a <mkdir>:
SYSCALL(mkdir)
59a: b8 14 00 00 00 mov $0x14,%eax
59f: cd 40 int $0x40
5a1: c3 ret
000005a2 <chdir>:
SYSCALL(chdir)
5a2: b8 09 00 00 00 mov $0x9,%eax
5a7: cd 40 int $0x40
5a9: c3 ret
000005aa <dup>:
SYSCALL(dup)
5aa: b8 0a 00 00 00 mov $0xa,%eax
5af: cd 40 int $0x40
5b1: c3 ret
000005b2 <getpid>:
SYSCALL(getpid)
5b2: b8 0b 00 00 00 mov $0xb,%eax
5b7: cd 40 int $0x40
5b9: c3 ret
000005ba <sbrk>:
SYSCALL(sbrk)
5ba: b8 0c 00 00 00 mov $0xc,%eax
5bf: cd 40 int $0x40
5c1: c3 ret
000005c2 <sleep>:
SYSCALL(sleep)
5c2: b8 0d 00 00 00 mov $0xd,%eax
5c7: cd 40 int $0x40
5c9: c3 ret
000005ca <uptime>:
SYSCALL(uptime)
5ca: b8 0e 00 00 00 mov $0xe,%eax
5cf: cd 40 int $0x40
5d1: c3 ret
000005d2 <hello>:
SYSCALL(hello)
5d2: b8 16 00 00 00 mov $0x16,%eax
5d7: cd 40 int $0x40
5d9: c3 ret
000005da <halt>:
SYSCALL(halt)
5da: b8 17 00 00 00 mov $0x17,%eax
5df: cd 40 int $0x40
5e1: c3 ret
000005e2 <gettop>:
SYSCALL(gettop)
5e2: b8 18 00 00 00 mov $0x18,%eax
5e7: cd 40 int $0x40
5e9: c3 ret
5ea: 66 90 xchg %ax,%ax
5ec: 66 90 xchg %ax,%ax
5ee: 66 90 xchg %ax,%ax
000005f0 <printint>:
write(fd, &c, 1);
}
static void
printint(int fd, int xx, int base, int sgn)
{
5f0: 55 push %ebp
5f1: 89 e5 mov %esp,%ebp
5f3: 57 push %edi
5f4: 56 push %esi
5f5: 89 c6 mov %eax,%esi
5f7: 53 push %ebx
5f8: 83 ec 4c sub $0x4c,%esp
char buf[16];
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
5fb: 8b 5d 08 mov 0x8(%ebp),%ebx
5fe: 85 db test %ebx,%ebx
600: 74 09 je 60b <printint+0x1b>
602: 89 d0 mov %edx,%eax
604: c1 e8 1f shr $0x1f,%eax
607: 84 c0 test %al,%al
609: 75 75 jne 680 <printint+0x90>
neg = 1;
x = -xx;
} else {
x = xx;
60b: 89 d0 mov %edx,%eax
static char digits[] = "0123456789ABCDEF";
char buf[16];
int i, neg;
uint x;
neg = 0;
60d: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp)
614: 89 75 c0 mov %esi,-0x40(%ebp)
x = -xx;
} else {
x = xx;
}
i = 0;
617: 31 ff xor %edi,%edi
619: 89 ce mov %ecx,%esi
61b: 8d 5d d7 lea -0x29(%ebp),%ebx
61e: eb 02 jmp 622 <printint+0x32>
do{
buf[i++] = digits[x % base];
620: 89 cf mov %ecx,%edi
622: 31 d2 xor %edx,%edx
624: f7 f6 div %esi
626: 8d 4f 01 lea 0x1(%edi),%ecx
629: 0f b6 92 35 0a 00 00 movzbl 0xa35(%edx),%edx
}while((x /= base) != 0);
630: 85 c0 test %eax,%eax
x = xx;
}
i = 0;
do{
buf[i++] = digits[x % base];
632: 88 14 0b mov %dl,(%ebx,%ecx,1)
}while((x /= base) != 0);
635: 75 e9 jne 620 <printint+0x30>
if(neg)
637: 8b 55 c4 mov -0x3c(%ebp),%edx
x = xx;
}
i = 0;
do{
buf[i++] = digits[x % base];
63a: 89 c8 mov %ecx,%eax
63c: 8b 75 c0 mov -0x40(%ebp),%esi
}while((x /= base) != 0);
if(neg)
63f: 85 d2 test %edx,%edx
641: 74 08 je 64b <printint+0x5b>
buf[i++] = '-';
643: 8d 4f 02 lea 0x2(%edi),%ecx
646: c6 44 05 d8 2d movb $0x2d,-0x28(%ebp,%eax,1)
while(--i >= 0)
64b: 8d 79 ff lea -0x1(%ecx),%edi
64e: 66 90 xchg %ax,%ax
650: 0f b6 44 3d d8 movzbl -0x28(%ebp,%edi,1),%eax
655: 83 ef 01 sub $0x1,%edi
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
658: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
65f: 00
660: 89 5c 24 04 mov %ebx,0x4(%esp)
664: 89 34 24 mov %esi,(%esp)
667: 88 45 d7 mov %al,-0x29(%ebp)
66a: e8 e3 fe ff ff call 552 <write>
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
66f: 83 ff ff cmp $0xffffffff,%edi
672: 75 dc jne 650 <printint+0x60>
putc(fd, buf[i]);
}
674: 83 c4 4c add $0x4c,%esp
677: 5b pop %ebx
678: 5e pop %esi
679: 5f pop %edi
67a: 5d pop %ebp
67b: c3 ret
67c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
uint x;
neg = 0;
if(sgn && xx < 0){
neg = 1;
x = -xx;
680: 89 d0 mov %edx,%eax
682: f7 d8 neg %eax
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
neg = 1;
684: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp)
68b: eb 87 jmp 614 <printint+0x24>
68d: 8d 76 00 lea 0x0(%esi),%esi
00000690 <printf>:
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, const char *fmt, ...)
{
690: 55 push %ebp
691: 89 e5 mov %esp,%ebp
693: 57 push %edi
char *s;
int c, i, state;
uint *ap;
state = 0;
694: 31 ff xor %edi,%edi
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, const char *fmt, ...)
{
696: 56 push %esi
697: 53 push %ebx
698: 83 ec 3c sub $0x3c,%esp
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
69b: 8b 5d 0c mov 0xc(%ebp),%ebx
char *s;
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
69e: 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, ...)
{
6a1: 8b 75 08 mov 0x8(%ebp),%esi
char *s;
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
6a4: 89 45 d4 mov %eax,-0x2c(%ebp)
for(i = 0; fmt[i]; i++){
6a7: 0f b6 13 movzbl (%ebx),%edx
6aa: 83 c3 01 add $0x1,%ebx
6ad: 84 d2 test %dl,%dl
6af: 75 39 jne 6ea <printf+0x5a>
6b1: e9 c2 00 00 00 jmp 778 <printf+0xe8>
6b6: 66 90 xchg %ax,%ax
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
6b8: 83 fa 25 cmp $0x25,%edx
6bb: 0f 84 bf 00 00 00 je 780 <printf+0xf0>
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
6c1: 8d 45 e2 lea -0x1e(%ebp),%eax
6c4: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
6cb: 00
6cc: 89 44 24 04 mov %eax,0x4(%esp)
6d0: 89 34 24 mov %esi,(%esp)
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
state = '%';
} else {
putc(fd, c);
6d3: 88 55 e2 mov %dl,-0x1e(%ebp)
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
6d6: e8 77 fe ff ff call 552 <write>
6db: 83 c3 01 add $0x1,%ebx
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
6de: 0f b6 53 ff movzbl -0x1(%ebx),%edx
6e2: 84 d2 test %dl,%dl
6e4: 0f 84 8e 00 00 00 je 778 <printf+0xe8>
c = fmt[i] & 0xff;
if(state == 0){
6ea: 85 ff test %edi,%edi
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
c = fmt[i] & 0xff;
6ec: 0f be c2 movsbl %dl,%eax
if(state == 0){
6ef: 74 c7 je 6b8 <printf+0x28>
if(c == '%'){
state = '%';
} else {
putc(fd, c);
}
} else if(state == '%'){
6f1: 83 ff 25 cmp $0x25,%edi
6f4: 75 e5 jne 6db <printf+0x4b>
if(c == 'd'){
6f6: 83 fa 64 cmp $0x64,%edx
6f9: 0f 84 31 01 00 00 je 830 <printf+0x1a0>
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
6ff: 25 f7 00 00 00 and $0xf7,%eax
704: 83 f8 70 cmp $0x70,%eax
707: 0f 84 83 00 00 00 je 790 <printf+0x100>
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
70d: 83 fa 73 cmp $0x73,%edx
710: 0f 84 a2 00 00 00 je 7b8 <printf+0x128>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
716: 83 fa 63 cmp $0x63,%edx
719: 0f 84 35 01 00 00 je 854 <printf+0x1c4>
putc(fd, *ap);
ap++;
} else if(c == '%'){
71f: 83 fa 25 cmp $0x25,%edx
722: 0f 84 e0 00 00 00 je 808 <printf+0x178>
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
728: 8d 45 e6 lea -0x1a(%ebp),%eax
72b: 83 c3 01 add $0x1,%ebx
72e: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
735: 00
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
736: 31 ff xor %edi,%edi
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
738: 89 44 24 04 mov %eax,0x4(%esp)
73c: 89 34 24 mov %esi,(%esp)
73f: 89 55 d0 mov %edx,-0x30(%ebp)
742: c6 45 e6 25 movb $0x25,-0x1a(%ebp)
746: e8 07 fe ff ff call 552 <write>
} else if(c == '%'){
putc(fd, c);
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
74b: 8b 55 d0 mov -0x30(%ebp),%edx
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
74e: 8d 45 e7 lea -0x19(%ebp),%eax
751: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
758: 00
759: 89 44 24 04 mov %eax,0x4(%esp)
75d: 89 34 24 mov %esi,(%esp)
} else if(c == '%'){
putc(fd, c);
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
760: 88 55 e7 mov %dl,-0x19(%ebp)
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
763: e8 ea fd ff ff call 552 <write>
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
768: 0f b6 53 ff movzbl -0x1(%ebx),%edx
76c: 84 d2 test %dl,%dl
76e: 0f 85 76 ff ff ff jne 6ea <printf+0x5a>
774: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
putc(fd, c);
}
state = 0;
}
}
}
778: 83 c4 3c add $0x3c,%esp
77b: 5b pop %ebx
77c: 5e pop %esi
77d: 5f pop %edi
77e: 5d pop %ebp
77f: c3 ret
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
state = '%';
780: bf 25 00 00 00 mov $0x25,%edi
785: e9 51 ff ff ff jmp 6db <printf+0x4b>
78a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
} else if(state == '%'){
if(c == 'd'){
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
printint(fd, *ap, 16, 0);
790: 8b 45 d4 mov -0x2c(%ebp),%eax
793: b9 10 00 00 00 mov $0x10,%ecx
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
798: 31 ff xor %edi,%edi
} else if(state == '%'){
if(c == 'd'){
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
printint(fd, *ap, 16, 0);
79a: c7 04 24 00 00 00 00 movl $0x0,(%esp)
7a1: 8b 10 mov (%eax),%edx
7a3: 89 f0 mov %esi,%eax
7a5: e8 46 fe ff ff call 5f0 <printint>
ap++;
7aa: 83 45 d4 04 addl $0x4,-0x2c(%ebp)
7ae: e9 28 ff ff ff jmp 6db <printf+0x4b>
7b3: 90 nop
7b4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
} else if(c == 's'){
s = (char*)*ap;
7b8: 8b 45 d4 mov -0x2c(%ebp),%eax
ap++;
7bb: 83 45 d4 04 addl $0x4,-0x2c(%ebp)
ap++;
} else if(c == 'x' || c == 'p'){
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
s = (char*)*ap;
7bf: 8b 38 mov (%eax),%edi
ap++;
if(s == 0)
s = "(null)";
7c1: b8 2e 0a 00 00 mov $0xa2e,%eax
7c6: 85 ff test %edi,%edi
7c8: 0f 44 f8 cmove %eax,%edi
while(*s != 0){
7cb: 0f b6 07 movzbl (%edi),%eax
7ce: 84 c0 test %al,%al
7d0: 74 2a je 7fc <printf+0x16c>
7d2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
7d8: 88 45 e3 mov %al,-0x1d(%ebp)
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
7db: 8d 45 e3 lea -0x1d(%ebp),%eax
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
7de: 83 c7 01 add $0x1,%edi
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
7e1: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
7e8: 00
7e9: 89 44 24 04 mov %eax,0x4(%esp)
7ed: 89 34 24 mov %esi,(%esp)
7f0: e8 5d fd ff ff call 552 <write>
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
7f5: 0f b6 07 movzbl (%edi),%eax
7f8: 84 c0 test %al,%al
7fa: 75 dc jne 7d8 <printf+0x148>
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
7fc: 31 ff xor %edi,%edi
7fe: e9 d8 fe ff ff jmp 6db <printf+0x4b>
803: 90 nop
804: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
808: 8d 45 e5 lea -0x1b(%ebp),%eax
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
80b: 31 ff xor %edi,%edi
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
80d: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
814: 00
815: 89 44 24 04 mov %eax,0x4(%esp)
819: 89 34 24 mov %esi,(%esp)
81c: c6 45 e5 25 movb $0x25,-0x1b(%ebp)
820: e8 2d fd ff ff call 552 <write>
825: e9 b1 fe ff ff jmp 6db <printf+0x4b>
82a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
} else {
putc(fd, c);
}
} else if(state == '%'){
if(c == 'd'){
printint(fd, *ap, 10, 1);
830: 8b 45 d4 mov -0x2c(%ebp),%eax
833: b9 0a 00 00 00 mov $0xa,%ecx
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
838: 66 31 ff xor %di,%di
} else {
putc(fd, c);
}
} else if(state == '%'){
if(c == 'd'){
printint(fd, *ap, 10, 1);
83b: c7 04 24 01 00 00 00 movl $0x1,(%esp)
842: 8b 10 mov (%eax),%edx
844: 89 f0 mov %esi,%eax
846: e8 a5 fd ff ff call 5f0 <printint>
ap++;
84b: 83 45 d4 04 addl $0x4,-0x2c(%ebp)
84f: e9 87 fe ff ff jmp 6db <printf+0x4b>
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
putc(fd, *ap);
854: 8b 45 d4 mov -0x2c(%ebp),%eax
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
857: 31 ff xor %edi,%edi
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
putc(fd, *ap);
859: 8b 00 mov (%eax),%eax
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
85b: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
862: 00
863: 89 34 24 mov %esi,(%esp)
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
putc(fd, *ap);
866: 88 45 e4 mov %al,-0x1c(%ebp)
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
869: 8d 45 e4 lea -0x1c(%ebp),%eax
86c: 89 44 24 04 mov %eax,0x4(%esp)
870: e8 dd fc ff ff call 552 <write>
putc(fd, *s);
s++;
}
} else if(c == 'c'){
putc(fd, *ap);
ap++;
875: 83 45 d4 04 addl $0x4,-0x2c(%ebp)
879: e9 5d fe ff ff jmp 6db <printf+0x4b>
87e: 66 90 xchg %ax,%ax
00000880 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
880: 55 push %ebp
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
881: a1 a0 0d 00 00 mov 0xda0,%eax
static Header base;
static Header *freep;
void
free(void *ap)
{
886: 89 e5 mov %esp,%ebp
888: 57 push %edi
889: 56 push %esi
88a: 53 push %ebx
88b: 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))
88e: 8b 08 mov (%eax),%ecx
void
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
890: 8d 53 f8 lea -0x8(%ebx),%edx
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
893: 39 d0 cmp %edx,%eax
895: 72 11 jb 8a8 <free+0x28>
897: 90 nop
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
898: 39 c8 cmp %ecx,%eax
89a: 72 04 jb 8a0 <free+0x20>
89c: 39 ca cmp %ecx,%edx
89e: 72 10 jb 8b0 <free+0x30>
8a0: 89 c8 mov %ecx,%eax
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
8a2: 39 d0 cmp %edx,%eax
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
8a4: 8b 08 mov (%eax),%ecx
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
8a6: 73 f0 jae 898 <free+0x18>
8a8: 39 ca cmp %ecx,%edx
8aa: 72 04 jb 8b0 <free+0x30>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
8ac: 39 c8 cmp %ecx,%eax
8ae: 72 f0 jb 8a0 <free+0x20>
break;
if(bp + bp->s.size == p->s.ptr){
8b0: 8b 73 fc mov -0x4(%ebx),%esi
8b3: 8d 3c f2 lea (%edx,%esi,8),%edi
8b6: 39 cf cmp %ecx,%edi
8b8: 74 1e je 8d8 <free+0x58>
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
} else
bp->s.ptr = p->s.ptr;
8ba: 89 4b f8 mov %ecx,-0x8(%ebx)
if(p + p->s.size == bp){
8bd: 8b 48 04 mov 0x4(%eax),%ecx
8c0: 8d 34 c8 lea (%eax,%ecx,8),%esi
8c3: 39 f2 cmp %esi,%edx
8c5: 74 28 je 8ef <free+0x6f>
p->s.size += bp->s.size;
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
8c7: 89 10 mov %edx,(%eax)
freep = p;
8c9: a3 a0 0d 00 00 mov %eax,0xda0
}
8ce: 5b pop %ebx
8cf: 5e pop %esi
8d0: 5f pop %edi
8d1: 5d pop %ebp
8d2: c3 ret
8d3: 90 nop
8d4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
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;
8d8: 03 71 04 add 0x4(%ecx),%esi
8db: 89 73 fc mov %esi,-0x4(%ebx)
bp->s.ptr = p->s.ptr->s.ptr;
8de: 8b 08 mov (%eax),%ecx
8e0: 8b 09 mov (%ecx),%ecx
8e2: 89 4b f8 mov %ecx,-0x8(%ebx)
} else
bp->s.ptr = p->s.ptr;
if(p + p->s.size == bp){
8e5: 8b 48 04 mov 0x4(%eax),%ecx
8e8: 8d 34 c8 lea (%eax,%ecx,8),%esi
8eb: 39 f2 cmp %esi,%edx
8ed: 75 d8 jne 8c7 <free+0x47>
p->s.size += bp->s.size;
8ef: 03 4b fc add -0x4(%ebx),%ecx
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
freep = p;
8f2: a3 a0 0d 00 00 mov %eax,0xda0
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;
8f7: 89 48 04 mov %ecx,0x4(%eax)
p->s.ptr = bp->s.ptr;
8fa: 8b 53 f8 mov -0x8(%ebx),%edx
8fd: 89 10 mov %edx,(%eax)
} else
p->s.ptr = bp;
freep = p;
}
8ff: 5b pop %ebx
900: 5e pop %esi
901: 5f pop %edi
902: 5d pop %ebp
903: c3 ret
904: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
90a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
00000910 <malloc>:
return freep;
}
void*
malloc(uint nbytes)
{
910: 55 push %ebp
911: 89 e5 mov %esp,%ebp
913: 57 push %edi
914: 56 push %esi
915: 53 push %ebx
916: 83 ec 1c sub $0x1c,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
919: 8b 45 08 mov 0x8(%ebp),%eax
if((prevp = freep) == 0){
91c: 8b 1d a0 0d 00 00 mov 0xda0,%ebx
malloc(uint nbytes)
{
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
922: 8d 48 07 lea 0x7(%eax),%ecx
925: c1 e9 03 shr $0x3,%ecx
if((prevp = freep) == 0){
928: 85 db test %ebx,%ebx
malloc(uint nbytes)
{
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
92a: 8d 71 01 lea 0x1(%ecx),%esi
if((prevp = freep) == 0){
92d: 0f 84 9b 00 00 00 je 9ce <malloc+0xbe>
933: 8b 13 mov (%ebx),%edx
935: 8b 7a 04 mov 0x4(%edx),%edi
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){
938: 39 fe cmp %edi,%esi
93a: 76 64 jbe 9a0 <malloc+0x90>
93c: 8d 04 f5 00 00 00 00 lea 0x0(,%esi,8),%eax
morecore(uint nu)
{
char *p;
Header *hp;
if(nu < 4096)
943: bb 00 80 00 00 mov $0x8000,%ebx
948: 89 45 e4 mov %eax,-0x1c(%ebp)
94b: eb 0e jmp 95b <malloc+0x4b>
94d: 8d 76 00 lea 0x0(%esi),%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){
950: 8b 02 mov (%edx),%eax
if(p->s.size >= nunits){
952: 8b 78 04 mov 0x4(%eax),%edi
955: 39 fe cmp %edi,%esi
957: 76 4f jbe 9a8 <malloc+0x98>
959: 89 c2 mov %eax,%edx
p->s.size = nunits;
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
95b: 3b 15 a0 0d 00 00 cmp 0xda0,%edx
961: 75 ed jne 950 <malloc+0x40>
morecore(uint nu)
{
char *p;
Header *hp;
if(nu < 4096)
963: 8b 45 e4 mov -0x1c(%ebp),%eax
966: 81 fe 00 10 00 00 cmp $0x1000,%esi
96c: bf 00 10 00 00 mov $0x1000,%edi
971: 0f 43 fe cmovae %esi,%edi
974: 0f 42 c3 cmovb %ebx,%eax
nu = 4096;
p = sbrk(nu * sizeof(Header));
977: 89 04 24 mov %eax,(%esp)
97a: e8 3b fc ff ff call 5ba <sbrk>
if(p == (char*)-1)
97f: 83 f8 ff cmp $0xffffffff,%eax
982: 74 18 je 99c <malloc+0x8c>
return 0;
hp = (Header*)p;
hp->s.size = nu;
984: 89 78 04 mov %edi,0x4(%eax)
free((void*)(hp + 1));
987: 83 c0 08 add $0x8,%eax
98a: 89 04 24 mov %eax,(%esp)
98d: e8 ee fe ff ff call 880 <free>
return freep;
992: 8b 15 a0 0d 00 00 mov 0xda0,%edx
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
if((p = morecore(nunits)) == 0)
998: 85 d2 test %edx,%edx
99a: 75 b4 jne 950 <malloc+0x40>
return 0;
99c: 31 c0 xor %eax,%eax
99e: eb 20 jmp 9c0 <malloc+0xb0>
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){
if(p->s.size >= nunits){
9a0: 89 d0 mov %edx,%eax
9a2: 89 da mov %ebx,%edx
9a4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
if(p->s.size == nunits)
9a8: 39 fe cmp %edi,%esi
9aa: 74 1c je 9c8 <malloc+0xb8>
prevp->s.ptr = p->s.ptr;
else {
p->s.size -= nunits;
9ac: 29 f7 sub %esi,%edi
9ae: 89 78 04 mov %edi,0x4(%eax)
p += p->s.size;
9b1: 8d 04 f8 lea (%eax,%edi,8),%eax
p->s.size = nunits;
9b4: 89 70 04 mov %esi,0x4(%eax)
}
freep = prevp;
9b7: 89 15 a0 0d 00 00 mov %edx,0xda0
return (void*)(p + 1);
9bd: 83 c0 08 add $0x8,%eax
}
if(p == freep)
if((p = morecore(nunits)) == 0)
return 0;
}
}
9c0: 83 c4 1c add $0x1c,%esp
9c3: 5b pop %ebx
9c4: 5e pop %esi
9c5: 5f pop %edi
9c6: 5d pop %ebp
9c7: 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;
9c8: 8b 08 mov (%eax),%ecx
9ca: 89 0a mov %ecx,(%edx)
9cc: eb e9 jmp 9b7 <malloc+0xa7>
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
9ce: c7 05 a0 0d 00 00 a4 movl $0xda4,0xda0
9d5: 0d 00 00
base.s.size = 0;
9d8: ba a4 0d 00 00 mov $0xda4,%edx
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
9dd: c7 05 a4 0d 00 00 a4 movl $0xda4,0xda4
9e4: 0d 00 00
base.s.size = 0;
9e7: c7 05 a8 0d 00 00 00 movl $0x0,0xda8
9ee: 00 00 00
9f1: e9 46 ff ff ff jmp 93c <malloc+0x2c>
|
CeladonMart1Object:
db $f ; border block
db $6 ; warps
db $7, $2, $0, $ff
db $7, $3, $0, $ff
db $7, $10, $1, $ff
db $7, $11, $1, $ff
db $1, $c, $0, CELADON_MART_2
db $1, $1, $0, CELADON_MART_ELEVATOR
db $2 ; signs
db $4, $b, $2 ; CeladonMart1Text2
db $1, $e, $3 ; CeladonMart1Text3
db $1 ; objects
object SPRITE_CABLE_CLUB_WOMAN, $8, $3, STAY, DOWN, $1 ; person
; warp-to
EVENT_DISP CELADON_MART_1_WIDTH, $7, $2
EVENT_DISP CELADON_MART_1_WIDTH, $7, $3
EVENT_DISP CELADON_MART_1_WIDTH, $7, $10
EVENT_DISP CELADON_MART_1_WIDTH, $7, $11
EVENT_DISP CELADON_MART_1_WIDTH, $1, $c ; CELADON_MART_2
EVENT_DISP CELADON_MART_1_WIDTH, $1, $1 ; CELADON_MART_ELEVATOR
|
// Copyright (c) 2009-2017 The Bitcoin Core developers
// Copyright (c) 2017 The Zcash developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <key.h>
#include <arith_uint256.h>
#include <crypto/common.h>
#include <crypto/hmac_sha512.h>
#include <random.h>
#include <secp256k1.h>
#include <secp256k1_recovery.h>
static secp256k1_context* secp256k1_context_sign = nullptr;
/** These functions are taken from the libsecp256k1 distribution and are very ugly. */
/**
* This parses a format loosely based on a DER encoding of the ECPrivateKey type from
* section C.4 of SEC 1 <http://www.secg.org/sec1-v2.pdf>, with the following caveats:
*
* * The octet-length of the SEQUENCE must be encoded as 1 or 2 octets. It is not
* required to be encoded as one octet if it is less than 256, as DER would require.
* * The octet-length of the SEQUENCE must not be greater than the remaining
* length of the key encoding, but need not match it (i.e. the encoding may contain
* junk after the encoded SEQUENCE).
* * The privateKey OCTET STRING is zero-filled on the left to 32 octets.
* * Anything after the encoding of the privateKey OCTET STRING is ignored, whether
* or not it is validly encoded DER.
*
* out32 must point to an output buffer of length at least 32 bytes.
*/
static int ec_privkey_import_der(const secp256k1_context* ctx, unsigned char *out32, const unsigned char *privkey, size_t privkeylen) {
const unsigned char *end = privkey + privkeylen;
memset(out32, 0, 32);
/* sequence header */
if (end - privkey < 1 || *privkey != 0x30u) {
return 0;
}
privkey++;
/* sequence length constructor */
if (end - privkey < 1 || !(*privkey & 0x80u)) {
return 0;
}
ptrdiff_t lenb = *privkey & ~0x80u; privkey++;
if (lenb < 1 || lenb > 2) {
return 0;
}
if (end - privkey < lenb) {
return 0;
}
/* sequence length */
ptrdiff_t len = privkey[lenb-1] | (lenb > 1 ? privkey[lenb-2] << 8 : 0u);
privkey += lenb;
if (end - privkey < len) {
return 0;
}
/* sequence element 0: version number (=1) */
if (end - privkey < 3 || privkey[0] != 0x02u || privkey[1] != 0x01u || privkey[2] != 0x01u) {
return 0;
}
privkey += 3;
/* sequence element 1: octet string, up to 32 bytes */
if (end - privkey < 2 || privkey[0] != 0x04u) {
return 0;
}
ptrdiff_t oslen = privkey[1];
privkey += 2;
if (oslen > 32 || end - privkey < oslen) {
return 0;
}
memcpy(out32 + (32 - oslen), privkey, oslen);
if (!secp256k1_ec_seckey_verify(ctx, out32)) {
memset(out32, 0, 32);
return 0;
}
return 1;
}
/**
* This serializes to a DER encoding of the ECPrivateKey type from section C.4 of SEC 1
* <http://www.secg.org/sec1-v2.pdf>. The optional parameters and publicKey fields are
* included.
*
* privkey must point to an output buffer of length at least CKey::PRIVATE_KEY_SIZE bytes.
* privkeylen must initially be set to the size of the privkey buffer. Upon return it
* will be set to the number of bytes used in the buffer.
* key32 must point to a 32-byte raw private key.
*/
static int ec_privkey_export_der(const secp256k1_context *ctx, unsigned char *privkey, size_t *privkeylen, const unsigned char *key32, int compressed) {
assert(*privkeylen >= CKey::PRIVATE_KEY_SIZE);
secp256k1_pubkey pubkey;
size_t pubkeylen = 0;
if (!secp256k1_ec_pubkey_create(ctx, &pubkey, key32)) {
*privkeylen = 0;
return 0;
}
if (compressed) {
static const unsigned char begin[] = {
0x30,0x81,0xD3,0x02,0x01,0x01,0x04,0x20
};
static const unsigned char middle[] = {
0xA0,0x81,0x85,0x30,0x81,0x82,0x02,0x01,0x01,0x30,0x2C,0x06,0x07,0x2A,0x86,0x48,
0xCE,0x3D,0x01,0x01,0x02,0x21,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFE,0xFF,0xFF,0xFC,0x2F,0x30,0x06,0x04,0x01,0x00,0x04,0x01,0x07,0x04,
0x21,0x02,0x79,0xBE,0x66,0x7E,0xF9,0xDC,0xBB,0xAC,0x55,0xA0,0x62,0x95,0xCE,0x87,
0x0B,0x07,0x02,0x9B,0xFC,0xDB,0x2D,0xCE,0x28,0xD9,0x59,0xF2,0x81,0x5B,0x16,0xF8,
0x17,0x98,0x02,0x21,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFE,0xBA,0xAE,0xDC,0xE6,0xAF,0x48,0xA0,0x3B,0xBF,0xD2,0x5E,
0x8C,0xD0,0x36,0x41,0x41,0x02,0x01,0x01,0xA1,0x24,0x03,0x22,0x00
};
unsigned char *ptr = privkey;
memcpy(ptr, begin, sizeof(begin)); ptr += sizeof(begin);
memcpy(ptr, key32, 32); ptr += 32;
memcpy(ptr, middle, sizeof(middle)); ptr += sizeof(middle);
pubkeylen = CPubKey::COMPRESSED_PUBLIC_KEY_SIZE;
secp256k1_ec_pubkey_serialize(ctx, ptr, &pubkeylen, &pubkey, SECP256K1_EC_COMPRESSED);
ptr += pubkeylen;
*privkeylen = ptr - privkey;
assert(*privkeylen == CKey::COMPRESSED_PRIVATE_KEY_SIZE);
} else {
static const unsigned char begin[] = {
0x30,0x82,0x01,0x13,0x02,0x01,0x01,0x04,0x20
};
static const unsigned char middle[] = {
0xA0,0x81,0xA5,0x30,0x81,0xA2,0x02,0x01,0x01,0x30,0x2C,0x06,0x07,0x2A,0x86,0x48,
0xCE,0x3D,0x01,0x01,0x02,0x21,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFE,0xFF,0xFF,0xFC,0x2F,0x30,0x06,0x04,0x01,0x00,0x04,0x01,0x07,0x04,
0x41,0x04,0x79,0xBE,0x66,0x7E,0xF9,0xDC,0xBB,0xAC,0x55,0xA0,0x62,0x95,0xCE,0x87,
0x0B,0x07,0x02,0x9B,0xFC,0xDB,0x2D,0xCE,0x28,0xD9,0x59,0xF2,0x81,0x5B,0x16,0xF8,
0x17,0x98,0x48,0x3A,0xDA,0x77,0x26,0xA3,0xC4,0x65,0x5D,0xA4,0xFB,0xFC,0x0E,0x11,
0x08,0xA8,0xFD,0x17,0xB4,0x48,0xA6,0x85,0x54,0x19,0x9C,0x47,0xD0,0x8F,0xFB,0x10,
0xD4,0xB8,0x02,0x21,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFE,0xBA,0xAE,0xDC,0xE6,0xAF,0x48,0xA0,0x3B,0xBF,0xD2,0x5E,
0x8C,0xD0,0x36,0x41,0x41,0x02,0x01,0x01,0xA1,0x44,0x03,0x42,0x00
};
unsigned char *ptr = privkey;
memcpy(ptr, begin, sizeof(begin)); ptr += sizeof(begin);
memcpy(ptr, key32, 32); ptr += 32;
memcpy(ptr, middle, sizeof(middle)); ptr += sizeof(middle);
pubkeylen = CPubKey::PUBLIC_KEY_SIZE;
secp256k1_ec_pubkey_serialize(ctx, ptr, &pubkeylen, &pubkey, SECP256K1_EC_UNCOMPRESSED);
ptr += pubkeylen;
*privkeylen = ptr - privkey;
assert(*privkeylen == CKey::PRIVATE_KEY_SIZE);
}
return 1;
}
bool CKey::Check(const unsigned char *vch) {
return secp256k1_ec_seckey_verify(secp256k1_context_sign, vch);
}
void CKey::MakeNewKey(bool fCompressedIn) {
do {
GetStrongRandBytes(keydata.data(), keydata.size());
} while (!Check(keydata.data()));
fValid = true;
fCompressed = fCompressedIn;
}
CPrivKey CKey::GetPrivKey() const {
assert(fValid);
CPrivKey privkey;
int ret;
size_t privkeylen;
privkey.resize(PRIVATE_KEY_SIZE);
privkeylen = PRIVATE_KEY_SIZE;
ret = ec_privkey_export_der(secp256k1_context_sign, (unsigned char*) privkey.data(), &privkeylen, begin(), fCompressed ? SECP256K1_EC_COMPRESSED : SECP256K1_EC_UNCOMPRESSED);
assert(ret);
privkey.resize(privkeylen);
return privkey;
}
CPubKey CKey::GetPubKey() const {
assert(fValid);
secp256k1_pubkey pubkey;
size_t clen = CPubKey::PUBLIC_KEY_SIZE;
CPubKey result;
int ret = secp256k1_ec_pubkey_create(secp256k1_context_sign, &pubkey, begin());
assert(ret);
secp256k1_ec_pubkey_serialize(secp256k1_context_sign, (unsigned char*)result.begin(), &clen, &pubkey, fCompressed ? SECP256K1_EC_COMPRESSED : SECP256K1_EC_UNCOMPRESSED);
assert(result.size() == clen);
assert(result.IsValid());
return result;
}
bool CKey::Sign(const uint256 &hash, std::vector<unsigned char>& vchSig, uint32_t test_case) const {
if (!fValid)
return false;
vchSig.resize(CPubKey::SIGNATURE_SIZE);
size_t nSigLen = CPubKey::SIGNATURE_SIZE;
unsigned char extra_entropy[32] = {0};
WriteLE32(extra_entropy, test_case);
secp256k1_ecdsa_signature sig;
int ret = secp256k1_ecdsa_sign(secp256k1_context_sign, &sig, hash.begin(), begin(), secp256k1_nonce_function_rfc6979, test_case ? extra_entropy : nullptr);
assert(ret);
secp256k1_ecdsa_signature_serialize_der(secp256k1_context_sign, (unsigned char*)vchSig.data(), &nSigLen, &sig);
vchSig.resize(nSigLen);
return true;
}
bool CKey::VerifyPubKey(const CPubKey& pubkey) const {
if (pubkey.IsCompressed() != fCompressed) {
return false;
}
unsigned char rnd[8];
std::string str = "Bitcoin key verification\n";
GetRandBytes(rnd, sizeof(rnd));
uint256 hash;
CHash256().Write((unsigned char*)str.data(), str.size()).Write(rnd, sizeof(rnd)).Finalize(hash.begin());
std::vector<unsigned char> vchSig;
Sign(hash, vchSig);
return pubkey.Verify(hash, vchSig);
}
bool CKey::SignCompact(const uint256 &hash, std::vector<unsigned char>& vchSig) const {
if (!fValid)
return false;
vchSig.resize(CPubKey::COMPACT_SIGNATURE_SIZE);
int rec = -1;
secp256k1_ecdsa_recoverable_signature sig;
int ret = secp256k1_ecdsa_sign_recoverable(secp256k1_context_sign, &sig, hash.begin(), begin(), secp256k1_nonce_function_rfc6979, nullptr);
assert(ret);
secp256k1_ecdsa_recoverable_signature_serialize_compact(secp256k1_context_sign, (unsigned char*)&vchSig[1], &rec, &sig);
assert(ret);
assert(rec != -1);
vchSig[0] = 27 + rec + (fCompressed ? 4 : 0);
return true;
}
bool CKey::Load(const CPrivKey &privkey, const CPubKey &vchPubKey, bool fSkipCheck=false) {
if (!ec_privkey_import_der(secp256k1_context_sign, (unsigned char*)begin(), privkey.data(), privkey.size()))
return false;
fCompressed = vchPubKey.IsCompressed();
fValid = true;
if (fSkipCheck)
return true;
return VerifyPubKey(vchPubKey);
}
bool CKey::Derive(CKey& keyChild, ChainCode &ccChild, unsigned int nChild, const ChainCode& cc) const {
assert(IsValid());
assert(IsCompressed());
std::vector<unsigned char, secure_allocator<unsigned char>> vout(64);
if ((nChild >> 31) == 0) {
CPubKey pubkey = GetPubKey();
assert(pubkey.size() == CPubKey::COMPRESSED_PUBLIC_KEY_SIZE);
BIP32Hash(cc, nChild, *pubkey.begin(), pubkey.begin()+1, vout.data());
} else {
assert(size() == 32);
BIP32Hash(cc, nChild, 0, begin(), vout.data());
}
memcpy(ccChild.begin(), vout.data()+32, 32);
memcpy((unsigned char*)keyChild.begin(), begin(), 32);
bool ret = secp256k1_ec_privkey_tweak_add(secp256k1_context_sign, (unsigned char*)keyChild.begin(), vout.data());
keyChild.fCompressed = true;
keyChild.fValid = ret;
return ret;
}
bool CExtKey::Derive(CExtKey &out, unsigned int _nChild) const {
out.nDepth = nDepth + 1;
CKeyID id = key.GetPubKey().GetID();
memcpy(&out.vchFingerprint[0], &id, 4);
out.nChild = _nChild;
return key.Derive(out.key, out.chaincode, _nChild, chaincode);
}
void CExtKey::SetMaster(const unsigned char *seed, unsigned int nSeedLen) {
static const unsigned char hashkey[] = {'B','i','t','c','o','i','n',' ','s','e','e','d'};
std::vector<unsigned char, secure_allocator<unsigned char>> vout(64);
CHMAC_SHA512(hashkey, sizeof(hashkey)).Write(seed, nSeedLen).Finalize(vout.data());
key.Set(vout.data(), vout.data() + 32, true);
memcpy(chaincode.begin(), vout.data() + 32, 32);
nDepth = 0;
nChild = 0;
memset(vchFingerprint, 0, sizeof(vchFingerprint));
}
CExtPubKey CExtKey::Neuter() const {
CExtPubKey ret;
ret.nDepth = nDepth;
memcpy(&ret.vchFingerprint[0], &vchFingerprint[0], 4);
ret.nChild = nChild;
ret.pubkey = key.GetPubKey();
ret.chaincode = chaincode;
return ret;
}
void CExtKey::Encode(unsigned char code[BIP32_EXTKEY_SIZE]) const {
code[0] = nDepth;
memcpy(code+1, vchFingerprint, 4);
code[5] = (nChild >> 24) & 0xFF; code[6] = (nChild >> 16) & 0xFF;
code[7] = (nChild >> 8) & 0xFF; code[8] = (nChild >> 0) & 0xFF;
memcpy(code+9, chaincode.begin(), 32);
code[41] = 0;
assert(key.size() == 32);
memcpy(code+42, key.begin(), 32);
}
void CExtKey::Decode(const unsigned char code[BIP32_EXTKEY_SIZE]) {
nDepth = code[0];
memcpy(vchFingerprint, code+1, 4);
nChild = (code[5] << 24) | (code[6] << 16) | (code[7] << 8) | code[8];
memcpy(chaincode.begin(), code+9, 32);
key.Set(code+42, code+BIP32_EXTKEY_SIZE, true);
}
bool ECC_InitSanityCheck() {
CKey key;
key.MakeNewKey(true);
CPubKey pubkey = key.GetPubKey();
return key.VerifyPubKey(pubkey);
}
void ECC_Start() {
assert(secp256k1_context_sign == nullptr);
secp256k1_context *ctx = secp256k1_context_create(SECP256K1_CONTEXT_SIGN);
assert(ctx != nullptr);
{
// Pass in a random blinding seed to the secp256k1 context.
std::vector<unsigned char, secure_allocator<unsigned char>> vseed(32);
GetRandBytes(vseed.data(), 32);
bool ret = secp256k1_context_randomize(ctx, vseed.data());
assert(ret);
}
secp256k1_context_sign = ctx;
}
void ECC_Stop() {
secp256k1_context *ctx = secp256k1_context_sign;
secp256k1_context_sign = nullptr;
if (ctx) {
secp256k1_context_destroy(ctx);
}
}
|
; A086028: a(n) = Sum_{i=1..n} C(i+5,6)^3.
; Submitted by Jon Maiga
; 1,344,22296,615000,9876000,108487128,897376152,5950405848,33031486875,158406862000,671944398512,2567519091888,8965083682032,28938181326000,87168786702000,246953567853744,662331582918141,1691011474896264,4129363811437000,9684000822437000,21887538335604000,47824502904405000,101296351722429000,208481764792437000,417828274694796375,816973354790872416,1561123672530302304,2919784952243856736,5352402615229532000,9628858488800028000,17018574238329845088,29583149843745367392,50623292440802268633
mov $2,$0
mov $3,$0
lpb $2
mov $0,$3
sub $2,1
sub $0,$2
seq $0,253946 ; a(n) = 6*binomial(n+1, 6).
pow $0,3
add $1,$0
lpe
mov $0,$1
div $0,216
add $0,1
|
// Copyright 2018 The Beam Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "wallet_transaction.h"
#include "core/block_crypt.h"
// TODO: getrandom not available until API 28 in the Android NDK 17b
// https://github.com/boostorg/uuid/issues/76
#if defined(__ANDROID__)
#define BOOST_UUID_RANDOM_PROVIDER_DISABLE_GETRANDOM 1
#endif
#include <boost/uuid/uuid_generators.hpp>
#include <numeric>
#include "utility/logger.h"
namespace beam { namespace wallet
{
using namespace ECC;
using namespace std;
TxID GenerateTxID()
{
boost::uuids::uuid id = boost::uuids::random_generator()();
TxID txID{};
copy(id.begin(), id.end(), txID.begin());
return txID;
}
std::string GetFailureMessage(TxFailureReason reason)
{
switch (reason)
{
#define MACRO(name, code, message) case name: return message;
BEAM_TX_FAILURE_REASON_MAP(MACRO)
#undef MACRO
}
return "Unknown reason";
}
TransactionFailedException::TransactionFailedException(bool notify, TxFailureReason reason, const char* message)
: std::runtime_error(message)
, m_Notify{notify}
, m_Reason{reason}
{
}
bool TransactionFailedException::ShouldNofify() const
{
return m_Notify;
}
TxFailureReason TransactionFailedException::GetReason() const
{
return m_Reason;
}
const uint32_t BaseTransaction::s_ProtoVersion = 1;
BaseTransaction::BaseTransaction(INegotiatorGateway& gateway
, beam::IWalletDB::Ptr walletDB
, const TxID& txID)
: m_Gateway{ gateway }
, m_WalletDB{ walletDB }
, m_ID{ txID }
{
assert(walletDB);
}
bool BaseTransaction::IsInitiator() const
{
if (!m_IsInitiator.is_initialized())
{
m_IsInitiator = GetMandatoryParameter<bool>(TxParameterID::IsInitiator);
}
return *m_IsInitiator;
}
uint32_t BaseTransaction::get_PeerVersion() const
{
uint32_t nVer = 0;
GetParameter(TxParameterID::PeerProtoVersion, nVer);
return nVer;
}
bool BaseTransaction::GetTip(Block::SystemState::Full& state) const
{
return m_Gateway.get_tip(state);
}
const TxID& BaseTransaction::GetTxID() const
{
return m_ID;
}
void BaseTransaction::Update()
{
try
{
if (CheckExternalFailures())
{
return;
}
UpdateImpl();
CheckExpired();
}
catch (const TransactionFailedException& ex)
{
LOG_ERROR() << GetTxID() << " exception msg: " << ex.what();
OnFailed(ex.GetReason(), ex.ShouldNofify());
}
catch (const exception& ex)
{
LOG_ERROR() << GetTxID() << " exception msg: " << ex.what();
}
}
void BaseTransaction::Cancel()
{
TxStatus s = TxStatus::Failed;
GetParameter(TxParameterID::Status, s);
if (s == TxStatus::Pending || s == TxStatus::InProgress)
{
NotifyFailure(TxFailureReason::Cancelled);
UpdateTxDescription(TxStatus::Cancelled);
RollbackTx();
m_Gateway.on_tx_completed(GetTxID());
}
else
{
LOG_INFO() << GetTxID() << " You cannot cancel transaction in state: " << static_cast<int>(s);
}
}
void BaseTransaction::RollbackTx()
{
LOG_INFO() << GetTxID() << " Transaction failed. Rollback...";
m_WalletDB->rollbackTx(GetTxID());
}
bool BaseTransaction::CheckExpired()
{
Height kernelConfirmHeight = 0;
if (GetParameter(TxParameterID::KernelProofHeight, kernelConfirmHeight) && kernelConfirmHeight > 0)
{
// completed tx
return false;
}
TxFailureReason reason = TxFailureReason::Unknown;
if (GetParameter(TxParameterID::FailureReason, reason))
{
// failed tx
return false;
}
Height maxHeight = MaxHeight;
if (!GetParameter(TxParameterID::MaxHeight, maxHeight)
&& !GetParameter(TxParameterID::PeerResponseHeight, maxHeight))
{
// we have no data to make decision
return false;
}
bool isRegistered = false;
Merkle::Hash kernelID;
if (!GetParameter(TxParameterID::TransactionRegistered, isRegistered)
|| !GetParameter(TxParameterID::KernelID, kernelID))
{
Block::SystemState::Full state;
if (GetTip(state) && state.m_Height > maxHeight)
{
LOG_INFO() << GetTxID() << " Transaction expired. Current height: " << state.m_Height << ", max kernel height: " << maxHeight;
OnFailed(TxFailureReason::TransactionExpired);
return true;
}
}
else
{
Height lastUnconfirmedHeight = 0;
if (GetParameter(TxParameterID::KernelUnconfirmedHeight, lastUnconfirmedHeight) && lastUnconfirmedHeight > 0)
{
if (lastUnconfirmedHeight >= maxHeight)
{
LOG_INFO() << GetTxID() << " Transaction expired. Last unconfirmeed height: " << lastUnconfirmedHeight << ", max kernel height: " << maxHeight;
OnFailed(TxFailureReason::TransactionExpired);
return true;
}
}
}
return false;
}
bool BaseTransaction::CheckExternalFailures()
{
TxFailureReason reason = TxFailureReason::Unknown;
if (GetParameter(TxParameterID::FailureReason, reason))
{
TxStatus s = GetMandatoryParameter<TxStatus>(TxParameterID::Status);
if (s == TxStatus::InProgress)
{
OnFailed(reason);
return true;
}
}
return false;
}
void BaseTransaction::ConfirmKernel(const TxKernel& kernel)
{
UpdateTxDescription(TxStatus::Registering);
m_Gateway.confirm_kernel(GetTxID(), kernel);
}
void BaseTransaction::UpdateOnNextTip()
{
m_Gateway.UpdateOnNextTip(GetTxID());
}
void BaseTransaction::CompleteTx()
{
LOG_INFO() << GetTxID() << " Transaction completed";
UpdateTxDescription(TxStatus::Completed);
m_Gateway.on_tx_completed(GetTxID());
}
void BaseTransaction::UpdateTxDescription(TxStatus s)
{
if (SetParameter(TxParameterID::Status, s, true))
{
SetParameter(TxParameterID::ModifyTime, getTimestamp(), false);
}
}
void BaseTransaction::OnFailed(TxFailureReason reason, bool notify)
{
LOG_ERROR() << GetTxID() << " Failed. " << GetFailureMessage(reason);
if (notify)
{
NotifyFailure(reason);
}
SetParameter(TxParameterID::FailureReason, reason, false);
UpdateTxDescription((reason == TxFailureReason::Cancelled) ? TxStatus::Cancelled : TxStatus::Failed);
RollbackTx();
m_Gateway.on_tx_completed(GetTxID());
}
void BaseTransaction::NotifyFailure(TxFailureReason reason)
{
TxStatus s = TxStatus::Failed;
GetParameter(TxParameterID::Status, s);
switch (s)
{
case TxStatus::Pending:
case TxStatus::InProgress:
// those are the only applicable statuses, where there's no chance tx can be valid
break;
default:
return;
}
SetTxParameter msg;
msg.AddParameter(TxParameterID::FailureReason, reason);
SendTxParameters(move(msg));
}
IWalletDB::Ptr BaseTransaction::GetWalletDB()
{
return m_WalletDB;
}
bool BaseTransaction::SendTxParameters(SetTxParameter&& msg) const
{
msg.m_TxID = GetTxID();
msg.m_Type = GetType();
WalletID peerID;
if (GetParameter(TxParameterID::MyID, msg.m_From)
&& GetParameter(TxParameterID::PeerID, peerID))
{
m_Gateway.send_tx_params(peerID, move(msg));
return true;
}
return false;
}
SimpleTransaction::SimpleTransaction(INegotiatorGateway& gateway
, beam::IWalletDB::Ptr walletDB
, const TxID& txID)
: BaseTransaction{ gateway, walletDB, txID }
{
}
TxType SimpleTransaction::GetType() const
{
return TxType::Simple;
}
void SimpleTransaction::UpdateImpl()
{
bool isSender = GetMandatoryParameter<bool>(TxParameterID::IsSender);
bool isSelfTx = IsSelfTx();
State txState = GetState();
AmountList amoutList;
if (!GetParameter(TxParameterID::AmountList, amoutList))
{
amoutList = AmountList{ GetMandatoryParameter<Amount>(TxParameterID::Amount) };
}
auto sharedBuilder = make_shared<TxBuilder>(*this, amoutList, GetMandatoryParameter<Amount>(TxParameterID::Fee));
TxBuilder& builder = *sharedBuilder;
builder.GenerateBlindingExcess();
if (!builder.GetInitialTxParams() && txState == State::Initial)
{
if (m_CompletedEvent)
{
return;
}
LOG_INFO() << GetTxID() << (isSender ? " Sending " : " Receiving ")
<< PrintableAmount(builder.GetAmount())
<< " (fee: " << PrintableAmount(builder.GetFee()) << ")";
if (isSender)
{
Height maxResponseHeight = 0;
if (GetParameter(TxParameterID::PeerResponseHeight, maxResponseHeight))
{
LOG_INFO() << GetTxID() << " Max height for response: " << maxResponseHeight;
}
builder.SelectInputs();
builder.AddChange();
}
if (isSelfTx || !isSender)
{
// create receiver utxo
for (const auto& amount : builder.GetAmountList())
{
builder.GenerateNewCoin(amount, false);
}
}
UpdateTxDescription(TxStatus::InProgress);
if (!builder.GetCoins().empty())
{
m_CompletedEvent = io::AsyncEvent::create(io::Reactor::get_Current(), [this, sharedBuilder]() mutable
{
if (!sharedBuilder->FinalizeOutputs())
{
//TODO: transaction is too big :(
}
Update();
});
m_OutputsFuture = async(launch::async, [this, sharedBuilder]() mutable
{
sharedBuilder->CreateOutputs();
m_CompletedEvent->post();
});
return;
}
}
uint64_t nAddrOwnID;
if (!GetParameter(TxParameterID::MyAddressID, nAddrOwnID))
{
WalletID wid;
if (GetParameter(TxParameterID::MyID, wid))
{
auto waddr = m_WalletDB->getAddress(wid);
if (waddr && waddr->m_OwnID)
SetParameter(TxParameterID::MyAddressID, waddr->m_OwnID);
}
}
builder.GenerateNonce();
if (!isSelfTx && !builder.GetPeerPublicExcessAndNonce())
{
assert(IsInitiator());
if (txState == State::Initial)
{
SendInvitation(builder, isSender);
SetState(State::Invitation);
}
UpdateOnNextTip();
return;
}
if (!builder.UpdateMaxHeight())
{
OnFailed(TxFailureReason::MaxHeightIsUnacceptable, true);
return;
}
builder.CreateKernel();
builder.SignPartial();
bool hasPeersInputsAndOutputs = builder.GetPeerInputsAndOutputs();
if (!isSelfTx && !builder.GetPeerSignature())
{
if (txState == State::Initial)
{
// invited participant
assert(!IsInitiator());
UpdateTxDescription(TxStatus::Registering);
ConfirmInvitation(builder, !hasPeersInputsAndOutputs);
uint32_t nVer = 0;
if (GetParameter(TxParameterID::PeerProtoVersion, nVer))
{
// for peers with new flow, we assume that after we have responded, we have to switch to the state of awaiting for proofs
SetParameter(TxParameterID::TransactionRegistered, true);
SetState(State::KernelConfirmation);
ConfirmKernel(builder.GetKernel());
}
else
{
SetState(State::InvitationConfirmation);
}
return;
}
if (IsInitiator())
{
return;
}
}
if (IsInitiator() && !builder.IsPeerSignatureValid())
{
OnFailed(TxFailureReason::InvalidPeerSignature, true);
return;
}
if (!isSelfTx && isSender && IsInitiator())
{
// verify peer payment acknowledgement
wallet::PaymentConfirmation pc;
WalletID widPeer, widMy;
bool bSuccess =
GetParameter(TxParameterID::PeerID, widPeer) &&
GetParameter(TxParameterID::MyID, widMy) &&
GetParameter(TxParameterID::KernelID, pc.m_KernelID) &&
GetParameter(TxParameterID::Amount, pc.m_Value) &&
GetParameter(TxParameterID::PaymentConfirmation, pc.m_Signature);
if (bSuccess)
{
pc.m_Sender = widMy.m_Pk;
bSuccess = pc.IsValid(widPeer.m_Pk);
}
if (!bSuccess)
{
if (!get_PeerVersion())
{
// older wallets don't support it. Check if unsigned payments are ok
uint8_t nRequired = 0;
wallet::getVar(*m_WalletDB, wallet::g_szPaymentProofRequired, nRequired);
if (!nRequired)
bSuccess = true;
}
if (!bSuccess)
{
OnFailed(TxFailureReason::NoPaymentProof);
return;
}
}
}
builder.FinalizeSignature();
bool isRegistered = false;
if (!GetParameter(TxParameterID::TransactionRegistered, isRegistered))
{
if (!isSelfTx && (!hasPeersInputsAndOutputs || IsInitiator()))
{
if (txState == State::Invitation)
{
UpdateTxDescription(TxStatus::Registering);
ConfirmTransaction(builder, !hasPeersInputsAndOutputs);
SetState(State::PeerConfirmation);
}
if (!hasPeersInputsAndOutputs)
{
return;
}
}
if (CheckExpired())
{
return;
}
// Construct transaction
auto transaction = builder.CreateTransaction();
// Verify final transaction
TxBase::Context::Params pars;
TxBase::Context ctx(pars);
if (!transaction->IsValid(ctx))
{
OnFailed(TxFailureReason::InvalidTransaction, true);
return;
}
m_Gateway.register_tx(GetTxID(), transaction);
SetState(State::Registration);
return;
}
if (!isRegistered)
{
OnFailed(TxFailureReason::FailedToRegister, true);
return;
}
Height hProof = 0;
GetParameter(TxParameterID::KernelProofHeight, hProof);
if (!hProof)
{
if (txState == State::Registration)
{
uint32_t nVer = 0;
if (!GetParameter(TxParameterID::PeerProtoVersion, nVer))
{
// notify old peer that transaction has been registered
NotifyTransactionRegistered();
}
}
SetState(State::KernelConfirmation);
ConfirmKernel(builder.GetKernel());
return;
}
vector<Coin> modified = m_WalletDB->getCoinsByTx(GetTxID());
for (auto& coin : modified)
{
bool bIn = (coin.m_createTxId == m_ID);
bool bOut = (coin.m_spentTxId == m_ID);
if (bIn || bOut)
{
if (bIn)
{
coin.m_confirmHeight = std::min(coin.m_confirmHeight, hProof);
coin.m_maturity = hProof + Rules::get().Maturity.Std; // so far we don't use incubation for our created outputs
}
if (bOut)
coin.m_spentHeight = std::min(coin.m_spentHeight, hProof);
}
}
GetWalletDB()->save(modified);
CompleteTx();
}
void SimpleTransaction::SendInvitation(const TxBuilder& builder, bool isSender)
{
SetTxParameter msg;
msg.AddParameter(TxParameterID::Amount, builder.GetAmount())
.AddParameter(TxParameterID::Fee, builder.GetFee())
.AddParameter(TxParameterID::MinHeight, builder.GetMinHeight())
.AddParameter(TxParameterID::Lifetime, builder.GetLifetime())
.AddParameter(TxParameterID::PeerMaxHeight, builder.GetMaxHeight())
.AddParameter(TxParameterID::IsSender, !isSender)
.AddParameter(TxParameterID::PeerProtoVersion, s_ProtoVersion)
.AddParameter(TxParameterID::PeerPublicExcess, builder.GetPublicExcess())
.AddParameter(TxParameterID::PeerPublicNonce, builder.GetPublicNonce());
if (!SendTxParameters(move(msg)))
{
OnFailed(TxFailureReason::FailedToSendParameters, false);
}
}
void SimpleTransaction::ConfirmInvitation(const TxBuilder& builder, bool sendUtxos)
{
LOG_INFO() << GetTxID() << " Transaction accepted. Kernel: " << builder.GetKernelIDString();
SetTxParameter msg;
msg
.AddParameter(TxParameterID::PeerProtoVersion, s_ProtoVersion)
.AddParameter(TxParameterID::PeerPublicExcess, builder.GetPublicExcess())
.AddParameter(TxParameterID::PeerSignature, builder.GetPartialSignature())
.AddParameter(TxParameterID::PeerPublicNonce, builder.GetPublicNonce())
.AddParameter(TxParameterID::PeerMaxHeight, builder.GetMaxHeight());
if (sendUtxos)
{
msg.AddParameter(TxParameterID::PeerInputs, builder.GetInputs())
.AddParameter(TxParameterID::PeerOutputs, builder.GetOutputs())
.AddParameter(TxParameterID::PeerOffset, builder.GetOffset());
}
assert(!IsSelfTx());
if (!GetMandatoryParameter<bool>(TxParameterID::IsSender))
{
wallet::PaymentConfirmation pc;
WalletID widPeer, widMy;
bool bSuccess =
GetParameter(TxParameterID::PeerID, widPeer) &&
GetParameter(TxParameterID::MyID, widMy) &&
GetParameter(TxParameterID::KernelID, pc.m_KernelID) &&
GetParameter(TxParameterID::Amount, pc.m_Value);
if (bSuccess)
{
pc.m_Sender = widPeer.m_Pk;
auto waddr = m_WalletDB->getAddress(widMy);
if (waddr && waddr->m_OwnID)
{
Scalar::Native sk;
m_WalletDB->get_MasterKdf()->DeriveKey(sk, Key::ID(waddr->m_OwnID, Key::Type::Bbs));
proto::Sk2Pk(widMy.m_Pk, sk);
pc.Sign(sk);
msg.AddParameter(TxParameterID::PaymentConfirmation, pc.m_Signature);
}
}
}
SendTxParameters(move(msg));
}
void SimpleTransaction::ConfirmTransaction(const TxBuilder& builder, bool sendUtxos)
{
uint32_t nVer = 0;
if (GetParameter(TxParameterID::PeerProtoVersion, nVer))
{
// we skip this step for new tx flow
return;
}
LOG_INFO() << GetTxID() << " Peer signature is valid. Kernel: " << builder.GetKernelIDString();
SetTxParameter msg;
msg.AddParameter(TxParameterID::PeerSignature, Scalar(builder.GetPartialSignature()));
if (sendUtxos)
{
msg.AddParameter(TxParameterID::PeerInputs, builder.GetInputs())
.AddParameter(TxParameterID::PeerOutputs, builder.GetOutputs())
.AddParameter(TxParameterID::PeerOffset, builder.GetOffset());
}
SendTxParameters(move(msg));
}
void SimpleTransaction::NotifyTransactionRegistered()
{
SetTxParameter msg;
msg.AddParameter(TxParameterID::TransactionRegistered, true);
SendTxParameters(move(msg));
}
bool SimpleTransaction::IsSelfTx() const
{
WalletID peerID = GetMandatoryParameter<WalletID>(TxParameterID::PeerID);
auto address = m_WalletDB->getAddress(peerID);
return address.is_initialized() && address->m_OwnID;
}
SimpleTransaction::State SimpleTransaction::GetState() const
{
State state = State::Initial;
GetParameter(TxParameterID::State, state);
return state;
}
bool SimpleTransaction::ShouldNotifyAboutChanges(TxParameterID paramID) const
{
switch (paramID)
{
case TxParameterID::Amount:
case TxParameterID::Fee:
case TxParameterID::MinHeight:
case TxParameterID::PeerID:
case TxParameterID::MyID:
case TxParameterID::CreateTime:
case TxParameterID::IsSender:
case TxParameterID::Status:
case TxParameterID::TransactionType:
case TxParameterID::KernelID:
return true;
default:
return false;
}
}
TxBuilder::TxBuilder(BaseTransaction& tx, const AmountList& amountList, Amount fee)
: m_Tx{ tx }
, m_AmountList{ amountList }
, m_Fee{ fee }
, m_Change{0}
, m_Lifetime{120}
, m_MinHeight{0}
, m_MaxHeight{MaxHeight}
, m_PeerMaxHeight{ MaxHeight }
{
}
void TxBuilder::SelectInputs()
{
CoinIDList preselectedCoinIDs;
vector<Coin> coins;
Amount preselectedAmount = 0;
if (m_Tx.GetParameter(TxParameterID::PreselectedCoins, preselectedCoinIDs) && !preselectedCoinIDs.empty())
{
coins = m_Tx.GetWalletDB()->getCoinsByID(preselectedCoinIDs);
for (auto& coin : coins)
{
preselectedAmount += coin.getAmount();
coin.m_spentTxId = m_Tx.GetTxID();
}
m_Tx.GetWalletDB()->save(coins);
}
Amount amountWithFee = GetAmount() + m_Fee;
if (preselectedAmount < amountWithFee)
{
auto selectedCoins = m_Tx.GetWalletDB()->selectCoins(amountWithFee - preselectedAmount);
copy(selectedCoins.begin(), selectedCoins.end(), back_inserter(coins));
}
if (coins.empty())
{
Totals totals(*m_Tx.GetWalletDB());
LOG_ERROR() << m_Tx.GetTxID() << " You only have " << PrintableAmount(totals.Avail);
throw TransactionFailedException(!m_Tx.IsInitiator(), TxFailureReason::NoInputs);
}
m_Inputs.reserve(m_Inputs.size() + coins.size());
Amount total = 0;
for (auto& coin : coins)
{
coin.m_spentTxId = m_Tx.GetTxID();
auto& input = m_Inputs.emplace_back(make_unique<Input>());
Scalar::Native blindingFactor;
m_Tx.GetWalletDB()->calcCommitment(blindingFactor, input->m_Commitment, coin.m_ID);
m_Offset += blindingFactor;
total += coin.m_ID.m_Value;
}
m_Change += total - amountWithFee;
m_Tx.SetParameter(TxParameterID::Change, m_Change, false);
m_Tx.SetParameter(TxParameterID::Inputs, m_Inputs, false);
m_Tx.SetParameter(TxParameterID::Offset, m_Offset, false);
m_Tx.GetWalletDB()->save(coins);
}
void TxBuilder::AddChange()
{
if (m_Change == 0)
{
return;
}
GenerateNewCoin(m_Change, true);
}
void TxBuilder::GenerateNewCoin(Amount amount, bool bChange)
{
Coin& newUtxo = m_Coins.emplace_back(amount);
newUtxo.m_createTxId = m_Tx.GetTxID();
if (bChange)
{
newUtxo.m_ID.m_Type = Key::Type::Change;
}
m_Tx.GetWalletDB()->store(newUtxo);
}
void TxBuilder::CreateOutputs()
{
for (const auto& utxo : m_Coins)
{
Scalar::Native blindingFactor;
Output::Ptr output = make_unique<Output>();
output->Create(blindingFactor, *m_Tx.GetWalletDB()->get_ChildKdf(utxo.m_ID.m_SubIdx), utxo.m_ID, *m_Tx.GetWalletDB()->get_MasterKdf());
blindingFactor = -blindingFactor;
m_Offset += blindingFactor;
m_Outputs.emplace_back(move(output));
}
}
void TxBuilder::AddOutput(Amount amount, bool bChange)
{
m_Outputs.push_back(CreateOutput(amount, bChange));
}
bool TxBuilder::FinalizeOutputs()
{
m_Tx.SetParameter(TxParameterID::Outputs, m_Outputs, false);
m_Tx.SetParameter(TxParameterID::Offset, m_Offset, false);
// TODO: check transaction size here
return true;
}
Output::Ptr TxBuilder::CreateOutput(Amount amount, bool bChange)
{
Coin newUtxo(amount);
newUtxo.m_createTxId = m_Tx.GetTxID();
if (bChange)
{
newUtxo.m_ID.m_Type = Key::Type::Change;
}
m_Tx.GetWalletDB()->store(newUtxo);
Scalar::Native blindingFactor;
Output::Ptr output = make_unique<Output>();
output->Create(blindingFactor, *m_Tx.GetWalletDB()->get_ChildKdf(newUtxo.m_ID.m_SubIdx), newUtxo.m_ID, *m_Tx.GetWalletDB()->get_MasterKdf());
blindingFactor = -blindingFactor;
m_Offset += blindingFactor;
return output;
}
void TxBuilder::CreateKernel()
{
// create kernel
assert(!m_Kernel);
m_Kernel = make_unique<TxKernel>();
m_Kernel->m_Fee = m_Fee;
m_Kernel->m_Height.m_Min = GetMinHeight();
m_Kernel->m_Height.m_Max = GetMaxHeight();
m_Kernel->m_Commitment = Zero;
m_Tx.SetParameter(TxParameterID::MaxHeight, GetMaxHeight());
}
void TxBuilder::GenerateBlindingExcess()
{
if (!m_Tx.GetParameter(TxParameterID::BlindingExcess, m_BlindingExcess))
{
Key::ID kid;
kid.m_Idx = m_Tx.GetWalletDB()->AllocateKidRange(1);
kid.m_Type = FOURCC_FROM(KerW);
kid.m_SubIdx = 0;
m_Tx.GetWalletDB()->get_MasterKdf()->DeriveKey(m_BlindingExcess, kid);
m_Tx.SetParameter(TxParameterID::BlindingExcess, m_BlindingExcess, false);
}
m_Offset += m_BlindingExcess;
m_BlindingExcess = -m_BlindingExcess;
}
void TxBuilder::GenerateNonce()
{
// Don't store the generated nonce for the kernel multisig. Instead - store the raw random, from which the nonce is derived using kdf.
NoLeak<Hash::Value> hvRandom;
if (!m_Tx.GetParameter(TxParameterID::MyNonce, hvRandom.V))
{
ECC::GenRandom(hvRandom.V);
m_Tx.SetParameter(TxParameterID::MyNonce, hvRandom.V, false);
}
m_Tx.GetWalletDB()->get_MasterKdf()->DeriveKey(m_MultiSig.m_Nonce, hvRandom.V);
}
Point::Native TxBuilder::GetPublicExcess() const
{
return Context::get().G * m_BlindingExcess;
}
Point::Native TxBuilder::GetPublicNonce() const
{
return Context::get().G * m_MultiSig.m_Nonce;
}
bool TxBuilder::GetPeerPublicExcessAndNonce()
{
return m_Tx.GetParameter(TxParameterID::PeerPublicExcess, m_PeerPublicExcess)
&& m_Tx.GetParameter(TxParameterID::PeerPublicNonce, m_PeerPublicNonce);
}
bool TxBuilder::GetPeerSignature()
{
if (m_Tx.GetParameter(TxParameterID::PeerSignature, m_PeerSignature))
{
LOG_DEBUG() << m_Tx.GetTxID() << " Received PeerSig:\t" << Scalar(m_PeerSignature);
return true;
}
return false;
}
bool TxBuilder::GetInitialTxParams()
{
m_Tx.GetParameter(TxParameterID::Inputs, m_Inputs);
m_Tx.GetParameter(TxParameterID::Outputs, m_Outputs);
m_Tx.GetParameter(TxParameterID::MinHeight, m_MinHeight);
m_Tx.GetParameter(TxParameterID::Lifetime, m_Lifetime);
m_Tx.GetParameter(TxParameterID::PeerMaxHeight, m_PeerMaxHeight);
return m_Tx.GetParameter(TxParameterID::Offset, m_Offset);
}
bool TxBuilder::GetPeerInputsAndOutputs()
{
// used temporary vars to avoid non-short circuit evaluation
bool hasInputs = m_Tx.GetParameter(TxParameterID::PeerInputs, m_PeerInputs);
bool hasOutputs = (m_Tx.GetParameter(TxParameterID::PeerOutputs, m_PeerOutputs)
&& m_Tx.GetParameter(TxParameterID::PeerOffset, m_PeerOffset));
return hasInputs || hasOutputs;
}
void TxBuilder::SignPartial()
{
// create signature
Point::Native totalPublicExcess = GetPublicExcess();
totalPublicExcess += m_PeerPublicExcess;
m_Kernel->m_Commitment = totalPublicExcess;
m_Kernel->get_Hash(m_Message);
m_MultiSig.m_NoncePub = GetPublicNonce() + m_PeerPublicNonce;
m_MultiSig.SignPartial(m_PartialSignature, m_Message, m_BlindingExcess);
StoreKernelID();
}
void TxBuilder::FinalizeSignature()
{
// final signature
m_Kernel->m_Signature.m_NoncePub = GetPublicNonce() + m_PeerPublicNonce;
m_Kernel->m_Signature.m_k = m_PartialSignature + m_PeerSignature;
StoreKernelID();
}
Transaction::Ptr TxBuilder::CreateTransaction()
{
assert(m_Kernel);
LOG_INFO() << m_Tx.GetTxID() << " Transaction created. Kernel: " << GetKernelIDString()
<< " min height: " << m_Kernel->m_Height.m_Min
<< " max height: " << m_Kernel->m_Height.m_Max;
// create transaction
auto transaction = make_shared<Transaction>();
transaction->m_vKernels.push_back(move(m_Kernel));
transaction->m_Offset = m_Offset + m_PeerOffset;
transaction->m_vInputs = move(m_Inputs);
transaction->m_vOutputs = move(m_Outputs);
move(m_PeerInputs.begin(), m_PeerInputs.end(), back_inserter(transaction->m_vInputs));
move(m_PeerOutputs.begin(), m_PeerOutputs.end(), back_inserter(transaction->m_vOutputs));
transaction->Normalize();
return transaction;
}
bool TxBuilder::IsPeerSignatureValid() const
{
Signature peerSig;
peerSig.m_NoncePub = m_MultiSig.m_NoncePub;
peerSig.m_k = m_PeerSignature;
return peerSig.IsValidPartial(m_Message, m_PeerPublicNonce, m_PeerPublicExcess);
}
Amount TxBuilder::GetAmount() const
{
return std::accumulate(m_AmountList.begin(), m_AmountList.end(), 0ULL);
}
const AmountList& TxBuilder::GetAmountList() const
{
return m_AmountList;
}
Amount TxBuilder::GetFee() const
{
return m_Fee;
}
Height TxBuilder::GetLifetime() const
{
return m_Lifetime;
}
Height TxBuilder::GetMinHeight() const
{
return m_MinHeight;
}
Height TxBuilder::GetMaxHeight() const
{
if (m_MaxHeight == MaxHeight)
{
return m_MinHeight + m_Lifetime;
}
return m_MaxHeight;
}
const vector<Input::Ptr>& TxBuilder::GetInputs() const
{
return m_Inputs;
}
const vector<Output::Ptr>& TxBuilder::GetOutputs() const
{
return m_Outputs;
}
const Scalar::Native& TxBuilder::GetOffset() const
{
return m_Offset;
}
const Scalar::Native& TxBuilder::GetPartialSignature() const
{
return m_PartialSignature;
}
const TxKernel& TxBuilder::GetKernel() const
{
assert(m_Kernel);
return *m_Kernel;
}
void TxBuilder::StoreKernelID()
{
assert(m_Kernel);
Merkle::Hash kernelID;
m_Kernel->get_ID(kernelID);
m_Tx.SetParameter(TxParameterID::KernelID, kernelID);
}
string TxBuilder::GetKernelIDString() const
{
Merkle::Hash kernelID;
m_Kernel->get_ID(kernelID);
char sz[Merkle::Hash::nTxtLen + 1];
kernelID.Print(sz);
return string(sz);
}
bool TxBuilder::UpdateMaxHeight()
{
if (!m_Tx.GetParameter(TxParameterID::MaxHeight, m_MaxHeight))
{
bool isInitiator = m_Tx.IsInitiator();
bool hasPeerMaxHeight = m_PeerMaxHeight < MaxHeight;
if (!isInitiator)
{
if (m_Tx.GetParameter(TxParameterID::Lifetime, m_Lifetime))
{
Block::SystemState::Full state;
if (m_Tx.GetTip(state))
{
m_MaxHeight = state.m_Height + m_Lifetime;
}
}
else if (hasPeerMaxHeight)
{
m_MaxHeight = m_PeerMaxHeight;
}
}
else if (hasPeerMaxHeight)
{
if (IsAcceptableMaxHeight())
{
m_MaxHeight = m_PeerMaxHeight;
}
else
{
return false;
}
}
}
return true;
}
bool TxBuilder::IsAcceptableMaxHeight() const
{
Height maxAcceptableHeight = m_Tx.GetMandatoryParameter<Height>(TxParameterID::PeerResponseHeight) +
m_Tx.GetMandatoryParameter<Height>(TxParameterID::Lifetime);
return m_PeerMaxHeight < MaxHeight && m_PeerMaxHeight <= maxAcceptableHeight;
}
const std::vector<Coin>& TxBuilder::GetCoins() const
{
return m_Coins;
}
}}
|
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r14
push %r9
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_normal_ht+0x70ec, %rsi
nop
nop
nop
xor $63536, %rdx
mov (%rsi), %r9d
nop
nop
nop
nop
sub $41355, %r10
lea addresses_WC_ht+0x1cf1e, %r12
nop
xor %r14, %r14
movb (%r12), %r10b
nop
and $7812, %r9
lea addresses_WT_ht+0xba64, %rsi
lea addresses_A_ht+0x1d43e, %rdi
nop
sub $36600, %r14
mov $73, %rcx
rep movsw
nop
nop
nop
cmp %rdx, %rdx
lea addresses_A_ht+0x741e, %r14
clflush (%r14)
nop
nop
nop
nop
and %rdx, %rdx
movb $0x61, (%r14)
nop
sub %r9, %r9
lea addresses_D_ht+0x1b5a2, %rsi
lea addresses_WC_ht+0x101e, %rdi
sub %r9, %r9
mov $81, %rcx
rep movsq
nop
nop
nop
nop
nop
add $8383, %r10
lea addresses_WC_ht+0x774e, %rdi
nop
nop
nop
nop
nop
inc %rdx
mov (%rdi), %r14
nop
nop
sub $23318, %rsi
lea addresses_A_ht+0x9a5e, %rdi
nop
xor %rdx, %rdx
movb $0x61, (%rdi)
nop
nop
xor $25659, %r14
lea addresses_D_ht+0x12e1e, %rsi
lea addresses_A_ht+0x7d77, %rdi
clflush (%rsi)
nop
nop
nop
cmp %r10, %r10
mov $124, %rcx
rep movsb
nop
and %r9, %r9
lea addresses_WT_ht+0x17b9e, %r12
nop
nop
nop
sub $64469, %rcx
mov (%r12), %r14w
nop
nop
nop
nop
xor %rdx, %rdx
lea addresses_normal_ht+0x1a1ce, %r14
nop
nop
nop
sub %rdx, %rdx
mov $0x6162636465666768, %rdi
movq %rdi, %xmm1
vmovups %ymm1, (%r14)
nop
and $14837, %r9
lea addresses_D_ht+0x1c29e, %rsi
nop
nop
nop
nop
and $14282, %rdx
mov (%rsi), %rdi
nop
nop
nop
nop
add %rsi, %rsi
lea addresses_D_ht+0x1221e, %r9
nop
add %rcx, %rcx
movl $0x61626364, (%r9)
add %r10, %r10
lea addresses_WC_ht+0x1c4, %r12
nop
nop
nop
cmp $28617, %r10
mov (%r12), %rsi
nop
nop
nop
nop
inc %rsi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r9
pop %r14
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r12
push %r8
push %rbx
push %rcx
// Faulty Load
lea addresses_WC+0x1841e, %rcx
nop
nop
add $9162, %r12
vmovups (%rcx), %ymm7
vextracti128 $0, %ymm7, %xmm7
vpextrq $0, %xmm7, %r10
lea oracles, %r12
and $0xff, %r10
shlq $12, %r10
mov (%r12,%r10,1), %r10
pop %rcx
pop %rbx
pop %r8
pop %r12
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_WC', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': True, 'size': 4, 'congruent': 1}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 7}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 0, 'type': 'addresses_WT_ht'}, 'dst': {'same': False, 'congruent': 5, 'type': 'addresses_A_ht'}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 9}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 2, 'type': 'addresses_D_ht'}, 'dst': {'same': False, 'congruent': 9, 'type': 'addresses_WC_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 4}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 6}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 7, 'type': 'addresses_D_ht'}, 'dst': {'same': False, 'congruent': 0, 'type': 'addresses_A_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': True, 'size': 2, 'congruent': 7}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 4}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 7}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 8}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 1}}
{'38': 21829}
38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38
*/
|
/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include "UiCanvasEditor_precompiled.h"
#include "EditorCommon.h"
#include "ViewportMoveGuideInteraction.h"
#include "CanvasHelpers.h"
#include "GuideHelpers.h"
#include <LyShine/Bus/UiEditorCanvasBus.h>
ViewportMoveGuideInteraction::ViewportMoveGuideInteraction(
EditorWindow* editorWindow,
AZ::EntityId canvasId,
bool guideIsVertical,
int guideIndex,
const AZ::Vector2& startDragMousePos
)
: ViewportDragInteraction(startDragMousePos)
, m_editorWindow(editorWindow)
, m_canvasId(canvasId)
, m_guideIsVertical(guideIsVertical)
, m_guideIndex(guideIndex)
, m_cursorViewportPos(0.0f, 0.0f)
{
// store whether snapping is enabled for this canvas
EBUS_EVENT_ID_RESULT(m_isSnapping, canvasId, UiEditorCanvasBus, GetIsSnapEnabled);
m_startingPosition = GuideHelpers::GetGuidePosition(canvasId, m_guideIsVertical, m_guideIndex);
// store the state before anything is moved
m_canvasUndoXml = CanvasHelpers::BeginUndoableCanvasChange(m_canvasId);
}
ViewportMoveGuideInteraction::~ViewportMoveGuideInteraction()
{
}
void ViewportMoveGuideInteraction::Update(const AZ::Vector2& mousePos)
{
// remember mouse position for render
m_cursorViewportPos = mousePos;
// Move the guide
MoveGuideToMousePos(mousePos);
}
void ViewportMoveGuideInteraction::Render(Draw2dHelper& draw2d)
{
// We don't need to render the guide since its position has been updated and the normal canvas render will draw it
// What we draw is the "visual aid" which in this case is a text display of the ruler position
float pos = GuideHelpers::GetGuidePosition(m_canvasId, m_guideIsVertical, m_guideIndex);
GuideHelpers::DrawGuidePosTextDisplay(draw2d, m_guideIsVertical, pos, m_editorWindow->GetViewport());
}
void ViewportMoveGuideInteraction::EndInteraction(EndState endState)
{
// If the interaction ended inside the viewport then do a move, else do a delete
const char* commandName = "move guide";
if (endState == EndState::OutsideXY || (m_guideIsVertical ? endState == EndState::OutsideX : endState == EndState::OutsideY))
{
GuideHelpers::RemoveGuide(m_canvasId, m_guideIsVertical, m_guideIndex);
commandName = "delete guide";
}
CanvasHelpers::EndUndoableCanvasChange(m_editorWindow, commandName, m_canvasUndoXml);
}
void ViewportMoveGuideInteraction::MoveGuideToMousePos(const AZ::Vector2& viewportPos)
{
AZ::Vector2 snappedPos = CanvasHelpers::GetSnappedCanvasPoint(m_canvasId, viewportPos, m_isSnapping);
GuideHelpers::SetGuidePosition(m_canvasId, m_guideIsVertical, m_guideIndex, snappedPos);
}
|
//
// _IND_PASS_TEST9_CPP_
//
// Copyright (C) 2017-2020 Tactical Computing Laboratories, LLC
// All Rights Reserved
// contact@tactcomplabs.com
//
// See LICENSE in the top level directory for licensing details
//
//
#include <iostream>
#include "CoreGen/CoreGenBackend/CoreGenBackend.h"
std::string PROJNAME = "TEST9";
std::string PROJROOT = "./";
std::string ARCHROOT = "./";
std::string PROJYAML = "../TEST9.yaml";
std::string TARGETPASS = "RegFieldPass";
int main( int argc, char **argv ){
CoreGenBackend *CG = new CoreGenBackend(PROJNAME,
PROJROOT,
ARCHROOT);
if( !CG ){
std::cout << "ERROR : FAILED TO CREATE COREGEN OBJECT" << std::endl;
return -1;
}
if( !CG->ReadIR( PROJYAML ) ){
std::cout << "ERROR : FAILED TO READ YAML IR:" << CG->GetErrStr() << std::endl;
delete CG;
return -1;
}
if( !CG->BuildDAG() ){
std::cout << "ERROR : FAILED TO BUILD THE DAG:" << CG->GetErrStr() << std::endl;
delete CG;
return -1;
}
if( !CG->InitPassMgr() ){
std::cout << "ERROR : FAILED TO INIT THE PASS MANAGER:" << CG->GetErrStr() << std::endl;
delete CG;
return -1;
}
if( !CG->ExecutePass(TARGETPASS) ){
std::cout << "ERROR : FAILED TO EXECUTE PASS : "
<< TARGETPASS << " : " << CG->GetErrStr() << std::endl;
delete CG;
return -1;
}
delete CG;
return 0;
}
|
;BASICS OF GNU 8085
LDA 2000;
MOV B, A;
MOV C, B;
ADD B;
hlt |
// Copyright (c) 2019 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=f60a48364a8a829b25ac48261e8147f5974175a3$
//
#include "libcef_dll/ctocpp/browser_host_ctocpp.h"
#include "libcef_dll/cpptoc/client_cpptoc.h"
#include "libcef_dll/cpptoc/download_image_callback_cpptoc.h"
#include "libcef_dll/cpptoc/navigation_entry_visitor_cpptoc.h"
#include "libcef_dll/cpptoc/pdf_print_callback_cpptoc.h"
#include "libcef_dll/cpptoc/run_file_dialog_callback_cpptoc.h"
#include "libcef_dll/ctocpp/browser_ctocpp.h"
#include "libcef_dll/ctocpp/drag_data_ctocpp.h"
#include "libcef_dll/ctocpp/extension_ctocpp.h"
#include "libcef_dll/ctocpp/navigation_entry_ctocpp.h"
#include "libcef_dll/ctocpp/request_context_ctocpp.h"
#include "libcef_dll/transfer_util.h"
// STATIC METHODS - Body may be edited by hand.
NO_SANITIZE("cfi-icall")
bool CefBrowserHost::CreateBrowser(
const CefWindowInfo& windowInfo,
CefRefPtr<CefClient> client,
const CefString& url,
const CefBrowserSettings& settings,
CefRefPtr<CefRequestContext> request_context) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Unverified params: client, url, request_context
// Execute
int _retval = cef_browser_host_create_browser(
&windowInfo, CefClientCppToC::Wrap(client), url.GetStruct(), &settings,
CefRequestContextCToCpp::Unwrap(request_context));
// Return type: bool
return _retval ? true : false;
}
NO_SANITIZE("cfi-icall")
CefRefPtr<CefBrowser> CefBrowserHost::CreateBrowserSync(
const CefWindowInfo& windowInfo,
CefRefPtr<CefClient> client,
const CefString& url,
const CefBrowserSettings& settings,
CefRefPtr<CefRequestContext> request_context) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Unverified params: client, url, request_context
// Execute
cef_browser_t* _retval = cef_browser_host_create_browser_sync(
&windowInfo, CefClientCppToC::Wrap(client), url.GetStruct(), &settings,
CefRequestContextCToCpp::Unwrap(request_context));
// Return type: refptr_same
return CefBrowserCToCpp::Wrap(_retval);
}
// VIRTUAL METHODS - Body may be edited by hand.
NO_SANITIZE("cfi-icall")
CefRefPtr<CefBrowser> CefBrowserHostCToCpp::GetBrowser() {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_browser))
return NULL;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_browser_t* _retval = _struct->get_browser(_struct);
// Return type: refptr_same
return CefBrowserCToCpp::Wrap(_retval);
}
NO_SANITIZE("cfi-icall")
void CefBrowserHostCToCpp::CloseBrowser(bool force_close) {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, close_browser))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->close_browser(_struct, force_close);
}
NO_SANITIZE("cfi-icall") bool CefBrowserHostCToCpp::TryCloseBrowser() {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, try_close_browser))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->try_close_browser(_struct);
// Return type: bool
return _retval ? true : false;
}
NO_SANITIZE("cfi-icall") void CefBrowserHostCToCpp::SetFocus(bool focus) {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, set_focus))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->set_focus(_struct, focus);
}
NO_SANITIZE("cfi-icall")
CefWindowHandle CefBrowserHostCToCpp::GetWindowHandle() {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_window_handle))
return kNullWindowHandle;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_window_handle_t _retval = _struct->get_window_handle(_struct);
// Return type: simple
return _retval;
}
NO_SANITIZE("cfi-icall")
CefWindowHandle CefBrowserHostCToCpp::GetOpenerWindowHandle() {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_opener_window_handle))
return kNullWindowHandle;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_window_handle_t _retval = _struct->get_opener_window_handle(_struct);
// Return type: simple
return _retval;
}
NO_SANITIZE("cfi-icall") bool CefBrowserHostCToCpp::HasView() {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, has_view))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->has_view(_struct);
// Return type: bool
return _retval ? true : false;
}
NO_SANITIZE("cfi-icall")
CefRefPtr<CefClient> CefBrowserHostCToCpp::GetClient() {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_client))
return NULL;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_client_t* _retval = _struct->get_client(_struct);
// Return type: refptr_diff
return CefClientCppToC::Unwrap(_retval);
}
NO_SANITIZE("cfi-icall")
CefRefPtr<CefRequestContext> CefBrowserHostCToCpp::GetRequestContext() {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_request_context))
return NULL;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_request_context_t* _retval = _struct->get_request_context(_struct);
// Return type: refptr_same
return CefRequestContextCToCpp::Wrap(_retval);
}
NO_SANITIZE("cfi-icall") double CefBrowserHostCToCpp::GetZoomLevel() {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_zoom_level))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
double _retval = _struct->get_zoom_level(_struct);
// Return type: simple
return _retval;
}
NO_SANITIZE("cfi-icall")
void CefBrowserHostCToCpp::SetZoomLevel(double zoomLevel) {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, set_zoom_level))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->set_zoom_level(_struct, zoomLevel);
}
NO_SANITIZE("cfi-icall")
void CefBrowserHostCToCpp::RunFileDialog(
FileDialogMode mode,
const CefString& title,
const CefString& default_file_path,
const std::vector<CefString>& accept_filters,
int selected_accept_filter,
CefRefPtr<CefRunFileDialogCallback> callback) {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, run_file_dialog))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: selected_accept_filter; type: simple_byval
DCHECK_GE(selected_accept_filter, 0);
if (selected_accept_filter < 0)
return;
// Verify param: callback; type: refptr_diff
DCHECK(callback.get());
if (!callback.get())
return;
// Unverified params: title, default_file_path, accept_filters
// Translate param: accept_filters; type: string_vec_byref_const
cef_string_list_t accept_filtersList = cef_string_list_alloc();
DCHECK(accept_filtersList);
if (accept_filtersList)
transfer_string_list_contents(accept_filters, accept_filtersList);
// Execute
_struct->run_file_dialog(_struct, mode, title.GetStruct(),
default_file_path.GetStruct(), accept_filtersList,
selected_accept_filter,
CefRunFileDialogCallbackCppToC::Wrap(callback));
// Restore param:accept_filters; type: string_vec_byref_const
if (accept_filtersList)
cef_string_list_free(accept_filtersList);
}
NO_SANITIZE("cfi-icall")
void CefBrowserHostCToCpp::StartDownload(const CefString& url) {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, start_download))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: url; type: string_byref_const
DCHECK(!url.empty());
if (url.empty())
return;
// Execute
_struct->start_download(_struct, url.GetStruct());
}
NO_SANITIZE("cfi-icall")
void CefBrowserHostCToCpp::DownloadImage(
const CefString& image_url,
bool is_favicon,
uint32 max_image_size,
bool bypass_cache,
CefRefPtr<CefDownloadImageCallback> callback) {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, download_image))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: image_url; type: string_byref_const
DCHECK(!image_url.empty());
if (image_url.empty())
return;
// Verify param: callback; type: refptr_diff
DCHECK(callback.get());
if (!callback.get())
return;
// Execute
_struct->download_image(_struct, image_url.GetStruct(), is_favicon,
max_image_size, bypass_cache,
CefDownloadImageCallbackCppToC::Wrap(callback));
}
NO_SANITIZE("cfi-icall") void CefBrowserHostCToCpp::Print() {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, print))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->print(_struct);
}
NO_SANITIZE("cfi-icall")
void CefBrowserHostCToCpp::PrintToPDF(const CefString& path,
const CefPdfPrintSettings& settings,
CefRefPtr<CefPdfPrintCallback> callback) {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, print_to_pdf))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: path; type: string_byref_const
DCHECK(!path.empty());
if (path.empty())
return;
// Unverified params: callback
// Execute
_struct->print_to_pdf(_struct, path.GetStruct(), &settings,
CefPdfPrintCallbackCppToC::Wrap(callback));
}
NO_SANITIZE("cfi-icall")
void CefBrowserHostCToCpp::Find(int identifier,
const CefString& searchText,
bool forward,
bool matchCase,
bool findNext) {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, find))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: searchText; type: string_byref_const
DCHECK(!searchText.empty());
if (searchText.empty())
return;
// Execute
_struct->find(_struct, identifier, searchText.GetStruct(), forward, matchCase,
findNext);
}
NO_SANITIZE("cfi-icall")
void CefBrowserHostCToCpp::StopFinding(bool clearSelection) {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, stop_finding))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->stop_finding(_struct, clearSelection);
}
NO_SANITIZE("cfi-icall")
void CefBrowserHostCToCpp::ShowDevTools(const CefWindowInfo& windowInfo,
CefRefPtr<CefClient> client,
const CefBrowserSettings& settings,
const CefPoint& inspect_element_at) {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, show_dev_tools))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Unverified params: windowInfo, client, settings, inspect_element_at
// Execute
_struct->show_dev_tools(_struct, &windowInfo, CefClientCppToC::Wrap(client),
&settings, &inspect_element_at);
}
NO_SANITIZE("cfi-icall") void CefBrowserHostCToCpp::CloseDevTools() {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, close_dev_tools))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->close_dev_tools(_struct);
}
NO_SANITIZE("cfi-icall") bool CefBrowserHostCToCpp::HasDevTools() {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, has_dev_tools))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->has_dev_tools(_struct);
// Return type: bool
return _retval ? true : false;
}
NO_SANITIZE("cfi-icall")
void CefBrowserHostCToCpp::GetNavigationEntries(
CefRefPtr<CefNavigationEntryVisitor> visitor,
bool current_only) {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_navigation_entries))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: visitor; type: refptr_diff
DCHECK(visitor.get());
if (!visitor.get())
return;
// Execute
_struct->get_navigation_entries(
_struct, CefNavigationEntryVisitorCppToC::Wrap(visitor), current_only);
}
NO_SANITIZE("cfi-icall")
void CefBrowserHostCToCpp::SetMouseCursorChangeDisabled(bool disabled) {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, set_mouse_cursor_change_disabled))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->set_mouse_cursor_change_disabled(_struct, disabled);
}
NO_SANITIZE("cfi-icall")
bool CefBrowserHostCToCpp::IsMouseCursorChangeDisabled() {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, is_mouse_cursor_change_disabled))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->is_mouse_cursor_change_disabled(_struct);
// Return type: bool
return _retval ? true : false;
}
NO_SANITIZE("cfi-icall")
void CefBrowserHostCToCpp::ReplaceMisspelling(const CefString& word) {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, replace_misspelling))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: word; type: string_byref_const
DCHECK(!word.empty());
if (word.empty())
return;
// Execute
_struct->replace_misspelling(_struct, word.GetStruct());
}
NO_SANITIZE("cfi-icall")
void CefBrowserHostCToCpp::AddWordToDictionary(const CefString& word) {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, add_word_to_dictionary))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: word; type: string_byref_const
DCHECK(!word.empty());
if (word.empty())
return;
// Execute
_struct->add_word_to_dictionary(_struct, word.GetStruct());
}
NO_SANITIZE("cfi-icall")
bool CefBrowserHostCToCpp::IsWindowRenderingDisabled() {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, is_window_rendering_disabled))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->is_window_rendering_disabled(_struct);
// Return type: bool
return _retval ? true : false;
}
NO_SANITIZE("cfi-icall") void CefBrowserHostCToCpp::WasResized() {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, was_resized))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->was_resized(_struct);
}
NO_SANITIZE("cfi-icall") void CefBrowserHostCToCpp::WasHidden(bool hidden) {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, was_hidden))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->was_hidden(_struct, hidden);
}
NO_SANITIZE("cfi-icall") void CefBrowserHostCToCpp::NotifyScreenInfoChanged() {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, notify_screen_info_changed))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->notify_screen_info_changed(_struct);
}
NO_SANITIZE("cfi-icall")
void CefBrowserHostCToCpp::Invalidate(PaintElementType type) {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, invalidate))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->invalidate(_struct, type);
}
NO_SANITIZE("cfi-icall") void CefBrowserHostCToCpp::SendExternalBeginFrame() {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, send_external_begin_frame))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->send_external_begin_frame(_struct);
}
NO_SANITIZE("cfi-icall")
void CefBrowserHostCToCpp::SendKeyEvent(const CefKeyEvent& event) {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, send_key_event))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->send_key_event(_struct, &event);
}
NO_SANITIZE("cfi-icall")
void CefBrowserHostCToCpp::SendMouseClickEvent(const CefMouseEvent& event,
MouseButtonType type,
bool mouseUp,
int clickCount) {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, send_mouse_click_event))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->send_mouse_click_event(_struct, &event, type, mouseUp, clickCount);
}
NO_SANITIZE("cfi-icall")
void CefBrowserHostCToCpp::SendMouseMoveEvent(const CefMouseEvent& event,
bool mouseLeave) {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, send_mouse_move_event))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->send_mouse_move_event(_struct, &event, mouseLeave);
}
NO_SANITIZE("cfi-icall")
void CefBrowserHostCToCpp::SendMouseWheelEvent(const CefMouseEvent& event,
int deltaX,
int deltaY) {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, send_mouse_wheel_event))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->send_mouse_wheel_event(_struct, &event, deltaX, deltaY);
}
NO_SANITIZE("cfi-icall")
void CefBrowserHostCToCpp::SendFocusEvent(bool setFocus) {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, send_focus_event))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->send_focus_event(_struct, setFocus);
}
NO_SANITIZE("cfi-icall") void CefBrowserHostCToCpp::SendCaptureLostEvent() {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, send_capture_lost_event))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->send_capture_lost_event(_struct);
}
NO_SANITIZE("cfi-icall")
void CefBrowserHostCToCpp::NotifyMoveOrResizeStarted() {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, notify_move_or_resize_started))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->notify_move_or_resize_started(_struct);
}
NO_SANITIZE("cfi-icall") int CefBrowserHostCToCpp::GetWindowlessFrameRate() {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_windowless_frame_rate))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->get_windowless_frame_rate(_struct);
// Return type: simple
return _retval;
}
NO_SANITIZE("cfi-icall")
void CefBrowserHostCToCpp::SetWindowlessFrameRate(int frame_rate) {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, set_windowless_frame_rate))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->set_windowless_frame_rate(_struct, frame_rate);
}
NO_SANITIZE("cfi-icall")
void CefBrowserHostCToCpp::ImeSetComposition(
const CefString& text,
const std::vector<CefCompositionUnderline>& underlines,
const CefRange& replacement_range,
const CefRange& selection_range) {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, ime_set_composition))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Unverified params: text, underlines
// Translate param: underlines; type: simple_vec_byref_const
const size_t underlinesCount = underlines.size();
cef_composition_underline_t* underlinesList = NULL;
if (underlinesCount > 0) {
underlinesList = new cef_composition_underline_t[underlinesCount];
DCHECK(underlinesList);
if (underlinesList) {
for (size_t i = 0; i < underlinesCount; ++i) {
underlinesList[i] = underlines[i];
}
}
}
// Execute
_struct->ime_set_composition(_struct, text.GetStruct(), underlinesCount,
underlinesList, &replacement_range,
&selection_range);
// Restore param:underlines; type: simple_vec_byref_const
if (underlinesList)
delete[] underlinesList;
}
NO_SANITIZE("cfi-icall")
void CefBrowserHostCToCpp::ImeCommitText(const CefString& text,
const CefRange& replacement_range,
int relative_cursor_pos) {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, ime_commit_text))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Unverified params: text
// Execute
_struct->ime_commit_text(_struct, text.GetStruct(), &replacement_range,
relative_cursor_pos);
}
NO_SANITIZE("cfi-icall")
void CefBrowserHostCToCpp::ImeFinishComposingText(bool keep_selection) {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, ime_finish_composing_text))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->ime_finish_composing_text(_struct, keep_selection);
}
NO_SANITIZE("cfi-icall") void CefBrowserHostCToCpp::ImeCancelComposition() {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, ime_cancel_composition))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->ime_cancel_composition(_struct);
}
NO_SANITIZE("cfi-icall")
void CefBrowserHostCToCpp::DragTargetDragEnter(CefRefPtr<CefDragData> drag_data,
const CefMouseEvent& event,
DragOperationsMask allowed_ops) {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, drag_target_drag_enter))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: drag_data; type: refptr_same
DCHECK(drag_data.get());
if (!drag_data.get())
return;
// Execute
_struct->drag_target_drag_enter(_struct, CefDragDataCToCpp::Unwrap(drag_data),
&event, allowed_ops);
}
NO_SANITIZE("cfi-icall")
void CefBrowserHostCToCpp::DragTargetDragOver(const CefMouseEvent& event,
DragOperationsMask allowed_ops) {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, drag_target_drag_over))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->drag_target_drag_over(_struct, &event, allowed_ops);
}
NO_SANITIZE("cfi-icall") void CefBrowserHostCToCpp::DragTargetDragLeave() {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, drag_target_drag_leave))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->drag_target_drag_leave(_struct);
}
NO_SANITIZE("cfi-icall")
void CefBrowserHostCToCpp::DragTargetDrop(const CefMouseEvent& event) {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, drag_target_drop))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->drag_target_drop(_struct, &event);
}
NO_SANITIZE("cfi-icall")
void CefBrowserHostCToCpp::DragSourceEndedAt(int x,
int y,
DragOperationsMask op) {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, drag_source_ended_at))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->drag_source_ended_at(_struct, x, y, op);
}
NO_SANITIZE("cfi-icall")
void CefBrowserHostCToCpp::DragSourceSystemDragEnded() {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, drag_source_system_drag_ended))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->drag_source_system_drag_ended(_struct);
}
NO_SANITIZE("cfi-icall")
CefRefPtr<
CefNavigationEntry> CefBrowserHostCToCpp::GetVisibleNavigationEntry() {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_visible_navigation_entry))
return NULL;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_navigation_entry_t* _retval =
_struct->get_visible_navigation_entry(_struct);
// Return type: refptr_same
return CefNavigationEntryCToCpp::Wrap(_retval);
}
NO_SANITIZE("cfi-icall")
void CefBrowserHostCToCpp::SetAccessibilityState(
cef_state_t accessibility_state) {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, set_accessibility_state))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->set_accessibility_state(_struct, accessibility_state);
}
NO_SANITIZE("cfi-icall")
void CefBrowserHostCToCpp::SetAutoResizeEnabled(bool enabled,
const CefSize& min_size,
const CefSize& max_size) {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, set_auto_resize_enabled))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->set_auto_resize_enabled(_struct, enabled, &min_size, &max_size);
}
NO_SANITIZE("cfi-icall")
CefRefPtr<CefExtension> CefBrowserHostCToCpp::GetExtension() {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_extension))
return NULL;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_extension_t* _retval = _struct->get_extension(_struct);
// Return type: refptr_same
return CefExtensionCToCpp::Wrap(_retval);
}
NO_SANITIZE("cfi-icall") bool CefBrowserHostCToCpp::IsBackgroundHost() {
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, is_background_host))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->is_background_host(_struct);
// Return type: bool
return _retval ? true : false;
}
// CONSTRUCTOR - Do not edit by hand.
CefBrowserHostCToCpp::CefBrowserHostCToCpp() {}
template <>
cef_browser_host_t*
CefCToCppRefCounted<CefBrowserHostCToCpp, CefBrowserHost, cef_browser_host_t>::
UnwrapDerived(CefWrapperType type, CefBrowserHost* c) {
NOTREACHED() << "Unexpected class type: " << type;
return NULL;
}
#if DCHECK_IS_ON()
template <>
base::AtomicRefCount CefCToCppRefCounted<CefBrowserHostCToCpp,
CefBrowserHost,
cef_browser_host_t>::DebugObjCt
ATOMIC_DECLARATION;
#endif
template <>
CefWrapperType CefCToCppRefCounted<CefBrowserHostCToCpp,
CefBrowserHost,
cef_browser_host_t>::kWrapperType =
WT_BROWSER_HOST;
|
//============================================================================
// Name : dnaiobms.hpp
// Author : Roger Fraser
// Contributors :
// Version : 1.00
// Copyright : Copyright 2017 Geoscience Australia
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http ://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Description : DynAdjust binary measurement file io operations
//============================================================================
#ifndef DNAIOBMS_H_
#define DNAIOBMS_H_
#if defined(_MSC_VER)
#if defined(LIST_INCLUDES_ON_BUILD)
#pragma message(" " __FILE__)
#endif
#endif
#include <include/io/dnaiobase.hpp>
#include <include/config/dnatypes.hpp>
#include <include/measurement_types/dnameasurement.hpp>
using namespace dynadjust::measurements;
namespace dynadjust {
namespace iostreams {
class dna_io_bms : public dna_io_base
{
public:
dna_io_bms(void) {};
dna_io_bms(const dna_io_bms&) {};
virtual ~dna_io_bms(void) {};
dna_io_bms& operator=(const dna_io_bms& rhs);
UINT16 create_msr_input_file_meta(vifm_t& vinput_file_meta, input_file_meta_t** input_file_meta);
void load_bms_file_meta(const string& bms_filename, binary_file_meta_t& bms_meta);
UINT32 load_bms_file(const string& bms_filename, pvmsr_t vbinary_msr, binary_file_meta_t& bms_meta);
void write_bms_file(const string& bms_filename, pvmsr_t vbinary_msr, binary_file_meta_t& bms_meta);
void write_bms_file(const string& bms_filename, vdnaMsrPtr* vMeasurements, binary_file_meta_t& bms_meta);
protected:
};
} // namespace measurements
} // namespace dynadjust
#endif
|
;Toggling PP5 to sound the buzzer using PWM (pulse width modulation) on Dragon12 Plus Trainer Board
;The J26 jumper selection allows to SPK_SEL (speaker selection) to be PT5, PP5 (PWM chan 5) or DACB output
;When the Dragon12 board is shipped the J26 jumper is set for PT5 of PORTT speaker/buzzer selection (Default setting).
;Because of this PT5 jumper setting you hear the speaker sound when the board is RESET
;This program toggles PP5 to sound the speaker/buzzer using the PWM of channel 5.
;Modified from Example 17-13 Mazidi & Causey HCS12 book. See Chapter 17 for PWM discussion
;Written and tested by M. Mazidi
;Before you run this program MAKE SURE YOU MOVE THE JUMPER ON J26 FROM PT5 TO PP5
;AFTER YOU RUN THIS PROGRAM MAKE SURE TO MOVE THE JUMPER BACK TO PT5.
;OTHERWISE UPON RESETING THE BOARD YOU WILL NOT HEAR THE SPEAKER/BUZZER SOUND
ABSENTRY Entry ; for absolute assembly: mark this as application entry point
; Include derivative-specific definitions
INCLUDE 'mc9s12dp256.inc' ;CPU used by Dragon12+ board
;code section
ORG $4000 ;Flash ROM address for Dragon12+
Entry:
LDS #$4000 ;Stack
MOVB #$04, PWMPRCLK ;ClockA=Fbus/2**4=24MHz/16=1.5MHz
MOVB #125, PWMSCLA ;ClockSA=1.5MHz/2x125=1.5Mhz/250=6000Hz
MOVB #$20, PWMCLK ;Use clockSA for chan 5 PWM
MOVB #$20,PWMPOL ;high then low for polarity
MOVB #$0,PWMCAE ;left aligned
MOVB #$0, PWMCTL ;8-bit chan,pwm during feeze and wait
MOVB #100, PWMPER5 ;PWM_Freq=ClockSA/100=6000 Hz/100=60 Hz. CHANGE THIS
MOVB #50, PWMDTY5 ;50% duty cycle AND THIS TO GET DIFFERENT SOUND
MOVB #0,PWMCNT5 ;start the counter with zero (optional)
BSET PWME,%00100000 ;enable chan 5 PWM
BRA $
;**************************************************************
;* Interrupt Vectors *
;**************************************************************
ORG $FFFE
DC.W Entry ;Reset Vector. CPU wakes here and it is sent to start of the code at $4000
|
/*
* Copyright 2016, Samuel Brand
*/
#include "Card.hpp"
#include <fmt/format.h>
#include <map>
#include <string>
namespace {
// clang-format off
const std::map<Card::Rank, std::string> RankStrings{{Card::Rank::eAce, "Ace"},
{Card::Rank::eKing, "King"},
{Card::Rank::eQueen, "Queen"},
{Card::Rank::eJack, "Jack"},
{Card::Rank::eTen, "Ten"},
{Card::Rank::eNine, "Nine"},
{Card::Rank::eEight, "Eight"},
{Card::Rank::eSeven, "Seven"},
{Card::Rank::eSix, "Six"}};
const std::map<Card::Suit, std::string> SuitStrings{{Card::Suit::eClubs, "Clubs"},
{Card::Suit::eDiamonds, "Diamonds"},
{Card::Suit::eHearts, "Hearts"},
{Card::Suit::eSpades, "Spades"}};
// clang-format on
} // namespace
template<>
struct fmt::formatter<Card::Suit> : fmt::formatter<std::string> {
template<typename FormatContext>
auto format(Card::Suit suit, FormatContext& context) {
const auto suitString = SuitStrings.find(suit);
if (suitString == std::cend(SuitStrings)) {
throw std::invalid_argument("Given Suit is invalid");
}
return fmt::formatter<std::string>::format(suitString->second, context);
}
};
template<>
struct fmt::formatter<Card::Rank> : fmt::formatter<std::string> {
template<typename FormatContext>
auto format(Card::Rank rank, FormatContext& context) {
const auto rankString = RankStrings.find(rank);
if (rankString == std::cend(RankStrings)) {
throw std::invalid_argument("Given Rank is invalid");
}
return fmt::formatter<std::string>::format(rankString->second, context);
}
};
std::ostream &operator<<(std::ostream &pOut, const Card &pCard) {
pOut << static_cast<std::string>(pCard);
return pOut;
}
bool operator==(const Card &left, const Card &right) noexcept {
return left.mRank == right.mRank && left.mSuit == right.mSuit;
}
Card::operator std::string() const {
return fmt::format(FMT_STRING("{} of {}"), mRank, mSuit);
}
|
/**
* pugixml parser - version 1.11
* --------------------------------------------------------
* Copyright (C) 2006-2020, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
* Report bugs and download new versions at https://pugixml.org/
*
* This library is distributed under the MIT License. See notice at the end
* of this file.
*
* This work is based on the pugxml parser, which is:
* Copyright (C) 2003, by Kristen Wegner (kristen@tima.net)
*/
#ifndef PUGIXML_VERSION
// Define version macro; evaluates to major * 1000 + minor * 10 + patch so that it's safe to use in less-than comparisons
// Note: pugixml used major * 100 + minor * 10 + patch format up until 1.9 (which had version identifier 190); starting from pugixml 1.10, the minor version number is two digits
# define PUGIXML_VERSION 1110
#endif
// Include user configuration file (this can define various configuration macros)
#include "pugiconfig.hpp"
#ifndef HEADER_PUGIXML_HPP
#define HEADER_PUGIXML_HPP
// Include stddef.h for size_t and ptrdiff_t
#include <stddef.h>
// Include exception header for XPath
#if !defined(PUGIXML_NO_XPATH) && !defined(PUGIXML_NO_EXCEPTIONS)
# include <exception>
#endif
// Include STL headers
#ifndef PUGIXML_NO_STL
# include <iterator>
# include <iosfwd>
# include <string>
#endif
#if (defined(__cplusplus) && __cplusplus == 201703L) || (defined(_MSC_VER) && _MSC_VER > 1900 && ((defined(_HAS_CXX17) && _HAS_CXX17 == 1) || (defined(_MSVC_LANG) && (_MSVC_LANG > 201402L))))
#ifndef PUGI_CXX17_FEATURES
#define PUGI_CXX17_FEATURES 1
#endif // C++17 features macro
#endif // C++17 features check
#if defined(PUGI_CXX17_FEATURES) && PUGI_CXX17_FEATURES
#include <string_view>
#endif // C++17 features
// Macro for deprecated features
#ifndef PUGIXML_DEPRECATED
# if defined(__GNUC__)
# define PUGIXML_DEPRECATED __attribute__((deprecated))
# elif defined(_MSC_VER) && _MSC_VER >= 1300
# define PUGIXML_DEPRECATED __declspec(deprecated)
# else
# define PUGIXML_DEPRECATED
# endif
#endif
// If no API is defined, assume default
#ifndef PUGIXML_API
# define PUGIXML_API
#endif
// If no API for classes is defined, assume default
#ifndef PUGIXML_CLASS
# define PUGIXML_CLASS PUGIXML_API
#endif
// If no API for functions is defined, assume default
#ifndef PUGIXML_FUNCTION
# define PUGIXML_FUNCTION PUGIXML_API
#endif
// If the platform is known to have long long support, enable long long functions
#ifndef PUGIXML_HAS_LONG_LONG
# if __cplusplus >= 201103
# define PUGIXML_HAS_LONG_LONG
# elif defined(_MSC_VER) && _MSC_VER >= 1400
# define PUGIXML_HAS_LONG_LONG
# endif
#endif
// If the platform is known to have move semantics support, compile move ctor/operator implementation
#ifndef PUGIXML_HAS_MOVE
# if __cplusplus >= 201103
# define PUGIXML_HAS_MOVE
# elif defined(_MSC_VER) && _MSC_VER >= 1600
# define PUGIXML_HAS_MOVE
# endif
#endif
// If C++ is 2011 or higher, add 'noexcept' specifiers
#ifndef PUGIXML_NOEXCEPT
# if __cplusplus >= 201103
# define PUGIXML_NOEXCEPT noexcept
# elif defined(_MSC_VER) && _MSC_VER >= 1900
# define PUGIXML_NOEXCEPT noexcept
# else
# define PUGIXML_NOEXCEPT
# endif
#endif
// Some functions can not be noexcept in compact mode
#ifdef PUGIXML_COMPACT
# define PUGIXML_NOEXCEPT_IF_NOT_COMPACT
#else
# define PUGIXML_NOEXCEPT_IF_NOT_COMPACT PUGIXML_NOEXCEPT
#endif
// If C++ is 2011 or higher, add 'override' qualifiers
#ifndef PUGIXML_OVERRIDE
# if __cplusplus >= 201103
# define PUGIXML_OVERRIDE override
# elif defined(_MSC_VER) && _MSC_VER >= 1700
# define PUGIXML_OVERRIDE override
# else
# define PUGIXML_OVERRIDE
# endif
#endif
// If C++ is 2011 or higher, use 'nullptr'
#ifndef PUGIXML_NULL
# if __cplusplus >= 201103
# define PUGIXML_NULL nullptr
# else
# define PUGIXML_NULL 0
# endif
#endif
// Character interface macros
#ifdef PUGIXML_WCHAR_MODE
# define PUGIXML_TEXT(t) L ## t
# define PUGIXML_CHAR wchar_t
#else
# define PUGIXML_TEXT(t) t
# define PUGIXML_CHAR char
#endif
// The string_view
namespace pugi {
#if defined(PUGI_CXX17_FEATURES) && PUGI_CXX17_FEATURES
template <typename C, typename T = std::char_traits<C> >
using basic_string_view = std::basic_string_view<C, T>;
typedef std::string_view string_view;
typedef std::wstring_view wstring_view;
#else
template <typename Char, typename Traits = std::char_traits<Char> >
struct basic_string_view {
const Char* p;
std::size_t s;
basic_string_view(const std::string& r)
: p(r.data()), s(r.size()) {
}
basic_string_view(const Char* ptr)
: p(ptr), s(Traits::length(ptr)) {
}
basic_string_view(const Char* ptr, std::size_t sz)
: p(ptr), s(sz) {
}
static int compare(const Char* lhs_p, std::size_t lhs_sz, const Char* rhs_p, std::size_t rhs_sz) {
int result = Traits::compare(lhs_p, rhs_p, lhs_sz < rhs_sz ? lhs_sz : rhs_sz);
if (result != 0)
return result;
if (lhs_sz < rhs_sz)
return -1;
if (lhs_sz > rhs_sz)
return 1;
return 0;
}
const Char* begin() const {
return p;
}
const Char* end() const {
return p + s;
}
const Char* cbegin() const {
return p;
}
const Char* cend() const {
return p + s;
}
const Char* data() const {
return p;
}
std::size_t size() const {
return s;
}
std::size_t length() const {
return size();
}
bool empty() const {
return 0 == s;
}
const Char& operator[](size_t index) const {
return p[index];
}
operator std::basic_string<Char, Traits>() const {
return std::basic_string<Char, Traits>(data(), size());
}
bool operator==(const basic_string_view& r) const {
return compare(p, s, r.data(), r.size()) == 0;
}
bool operator==(const Char* r) const {
return compare(r, Traits::length(r), p, s) == 0;
}
bool operator==(const std::basic_string<Char, Traits>& r) const {
return compare(r.data(), r.size(), p, s) == 0;
}
bool operator!=(const basic_string_view& r) const {
return !(*this == r);
}
bool operator!=(const char* r) const {
return !(*this == r);
}
bool operator!=(const std::basic_string<Char, Traits>& r) const {
return !(*this == r);
}
};
} // namespace pugi
namespace pugi {
typedef basic_string_view<char> string_view;
typedef basic_string_view<wchar_t> wstring_view;
#endif
} // namespace pugi
// The explicit boolean type to avoid compiler ambiguous match const char_t* as scalar type 'bool',
// because we preferred compiler match const char_t* as string_view_t
namespace pugi {
struct boolean {
boolean() : value(false) {}
explicit boolean(bool bval) : value(bval) {}
bool value;
operator bool() const { return value; }
};
static const boolean (true_value)(true);
static const boolean (false_value)(false);
} // namespace pugi
namespace pugi
{
// Character type used for all internal storage and operations; depends on PUGIXML_WCHAR_MODE
typedef PUGIXML_CHAR char_t;
#ifndef PUGIXML_NO_STL
// String type used for operations that work with STL string; depends on PUGIXML_WCHAR_MODE
typedef std::basic_string<PUGIXML_CHAR, std::char_traits<PUGIXML_CHAR>, std::allocator<PUGIXML_CHAR> > string_t;
#endif
// string_view type used for operations that work with pugi::string_view, depends on PUGIXML_WCHAR_MODE
typedef pugi::basic_string_view<char_t, std::char_traits<char_t> > string_view_t;
}
#define PUGIXML_EMPTY_SV pugi::string_view_t(PUGIXML_TEXT(""), 0)
// The PugiXML namespace
namespace pugi
{
// Tree node types
enum xml_node_type
{
node_null, // Empty (null) node handle
node_document, // A document tree's absolute root
node_element, // Element tag, i.e. '<node/>'
node_pcdata, // Plain character data, i.e. 'text'
node_cdata, // Character data, i.e. '<![CDATA[text]]>'
node_comment, // Comment tag, i.e. '<!-- text -->'
node_pi, // Processing instruction, i.e. '<?name?>'
node_declaration, // Document declaration, i.e. '<?xml version="1.0"?>'
node_doctype // Document type declaration, i.e. '<!DOCTYPE doc>'
};
// Parsing options
// Minimal parsing mode (equivalent to turning all other flags off).
// Only elements and PCDATA sections are added to the DOM tree, no text conversions are performed.
const unsigned int parse_minimal = 0x0000;
// This flag determines if processing instructions (node_pi) are added to the DOM tree. This flag is off by default.
const unsigned int parse_pi = 0x0001;
// This flag determines if comments (node_comment) are added to the DOM tree. This flag is off by default.
const unsigned int parse_comments = 0x0002;
// This flag determines if CDATA sections (node_cdata) are added to the DOM tree. This flag is on by default.
const unsigned int parse_cdata = 0x0004;
// This flag determines if plain character data (node_pcdata) that consist only of whitespace are added to the DOM tree.
// This flag is off by default; turning it on usually results in slower parsing and more memory consumption.
const unsigned int parse_ws_pcdata = 0x0008;
// This flag determines if character and entity references are expanded during parsing. This flag is on by default.
const unsigned int parse_escapes = 0x0010;
// This flag determines if EOL characters are normalized (converted to #xA) during parsing. This flag is on by default.
const unsigned int parse_eol = 0x0020;
// This flag determines if attribute values are normalized using CDATA normalization rules during parsing. This flag is on by default.
const unsigned int parse_wconv_attribute = 0x0040;
// This flag determines if attribute values are normalized using NMTOKENS normalization rules during parsing. This flag is off by default.
const unsigned int parse_wnorm_attribute = 0x0080;
// This flag determines if document declaration (node_declaration) is added to the DOM tree. This flag is off by default.
const unsigned int parse_declaration = 0x0100;
// This flag determines if document type declaration (node_doctype) is added to the DOM tree. This flag is off by default.
const unsigned int parse_doctype = 0x0200;
// This flag determines if plain character data (node_pcdata) that is the only child of the parent node and that consists only
// of whitespace is added to the DOM tree.
// This flag is off by default; turning it on may result in slower parsing and more memory consumption.
const unsigned int parse_ws_pcdata_single = 0x0400;
// This flag determines if leading and trailing whitespace is to be removed from plain character data. This flag is off by default.
const unsigned int parse_trim_pcdata = 0x0800;
// This flag determines if plain character data that does not have a parent node is added to the DOM tree, and if an empty document
// is a valid document. This flag is off by default.
const unsigned int parse_fragment = 0x1000;
// This flag determines if plain character data is be stored in the parent element's value. This significantly changes the structure of
// the document; this flag is only recommended for parsing documents with many PCDATA nodes in memory-constrained environments.
// This flag is off by default.
const unsigned int parse_embed_pcdata = 0x2000;
// The default parsing mode.
// Elements, PCDATA and CDATA sections are added to the DOM tree, character/reference entities are expanded,
// End-of-Line characters are normalized, attribute values are normalized using CDATA normalization rules.
const unsigned int parse_default = parse_cdata | parse_escapes | parse_wconv_attribute | parse_eol;
// The full parsing mode.
// Nodes of all types are added to the DOM tree, character/reference entities are expanded,
// End-of-Line characters are normalized, attribute values are normalized using CDATA normalization rules.
const unsigned int parse_full = parse_default | parse_pi | parse_comments | parse_declaration | parse_doctype;
// These flags determine the encoding of input data for XML document
enum xml_encoding
{
encoding_auto, // Auto-detect input encoding using BOM or < / <? detection; use UTF8 if BOM is not found
encoding_utf8, // UTF8 encoding
encoding_utf16_le, // Little-endian UTF16
encoding_utf16_be, // Big-endian UTF16
encoding_utf16, // UTF16 with native endianness
encoding_utf32_le, // Little-endian UTF32
encoding_utf32_be, // Big-endian UTF32
encoding_utf32, // UTF32 with native endianness
encoding_wchar, // The same encoding wchar_t has (either UTF16 or UTF32)
encoding_latin1
};
// Formatting flags
// Indent the nodes that are written to output stream with as many indentation strings as deep the node is in DOM tree. This flag is on by default.
const unsigned int format_indent = 0x01;
// Write encoding-specific BOM to the output stream. This flag is off by default.
const unsigned int format_write_bom = 0x02;
// Use raw output mode (no indentation and no line breaks are written). This flag is off by default.
const unsigned int format_raw = 0x04;
// Omit default XML declaration even if there is no declaration in the document. This flag is off by default.
const unsigned int format_no_declaration = 0x08;
// Don't escape attribute values and PCDATA contents. This flag is off by default.
const unsigned int format_no_escapes = 0x10;
// Open file using text mode in xml_document::save_file. This enables special character (i.e. new-line) conversions on some systems. This flag is off by default.
const unsigned int format_save_file_text = 0x20;
// Write every attribute on a new line with appropriate indentation. This flag is off by default.
const unsigned int format_indent_attributes = 0x40;
// Don't output empty element tags, instead writing an explicit start and end tag even if there are no children. This flag is off by default.
const unsigned int format_no_empty_element_tags = 0x80;
// Skip characters belonging to range [0; 32) instead of "&#xNN;" encoding. This flag is off by default.
const unsigned int format_skip_control_chars = 0x100;
// Use single quotes ' instead of double quotes " for enclosing attribute values. This flag is off by default.
const unsigned int format_attribute_single_quote = 0x200;
// The default set of formatting flags.
// Nodes are indented depending on their depth in DOM tree, a default declaration is output if document has none.
const unsigned int format_default = format_indent;
const int default_double_precision = 17;
const int default_float_precision = 9;
// Forward declarations
struct xml_attribute_struct;
struct xml_node_struct;
class xml_node_iterator;
class xml_attribute_iterator;
class xml_named_node_iterator;
class xml_tree_walker;
struct xml_parse_result;
class xml_node;
class xml_text;
#ifndef PUGIXML_NO_XPATH
class xpath_node;
class xpath_node_set;
class xpath_query;
class xpath_variable_set;
#endif
// Range-based for loop support
template <typename It> class xml_object_range
{
public:
typedef It const_iterator;
typedef It iterator;
xml_object_range(It b, It e): _begin(b), _end(e)
{
}
It begin() const { return _begin; }
It end() const { return _end; }
bool empty() const { return _begin == _end; }
private:
It _begin, _end;
};
// Writer interface for node printing (see xml_node::print)
class PUGIXML_CLASS xml_writer
{
public:
virtual ~xml_writer() {}
// Write memory chunk into stream/file/whatever
virtual void write(const void* data, size_t size) = 0;
};
// xml_writer implementation for FILE*
class PUGIXML_CLASS xml_writer_file: public xml_writer
{
public:
// Construct writer from a FILE* object; void* is used to avoid header dependencies on stdio
xml_writer_file(void* file);
virtual void write(const void* data, size_t size) PUGIXML_OVERRIDE;
private:
void* file;
};
#ifndef PUGIXML_NO_STL
// xml_writer implementation for streams
class PUGIXML_CLASS xml_writer_stream: public xml_writer
{
public:
// Construct writer from an output stream object
xml_writer_stream(std::basic_ostream<char, std::char_traits<char> >& stream);
xml_writer_stream(std::basic_ostream<wchar_t, std::char_traits<wchar_t> >& stream);
virtual void write(const void* data, size_t size) PUGIXML_OVERRIDE;
private:
std::basic_ostream<char, std::char_traits<char> >* narrow_stream;
std::basic_ostream<wchar_t, std::char_traits<wchar_t> >* wide_stream;
};
#endif
// A light-weight handle for manipulating attributes in DOM tree
class PUGIXML_CLASS xml_attribute
{
friend class xml_attribute_iterator;
friend class xml_node;
private:
xml_attribute_struct* _attr;
typedef void (*unspecified_bool_type)(xml_attribute***);
public:
// Default constructor. Constructs an empty attribute.
xml_attribute();
// Constructs attribute from internal pointer
explicit xml_attribute(xml_attribute_struct* attr);
// Safe bool conversion operator
operator unspecified_bool_type() const;
// Borland C++ workaround
bool operator!() const;
// Comparison operators (compares wrapped attribute pointers)
bool operator==(const xml_attribute& r) const;
bool operator!=(const xml_attribute& r) const;
bool operator<(const xml_attribute& r) const;
bool operator>(const xml_attribute& r) const;
bool operator<=(const xml_attribute& r) const;
bool operator>=(const xml_attribute& r) const;
// Check if attribute is empty
bool empty() const;
// Get attribute name/value, or "" if attribute is empty
string_view_t name() const;
string_view_t value() const;
// Get attribute value, or the default value if attribute is empty
string_view_t as_string(string_view_t def = PUGIXML_EMPTY_SV) const;
// Get attribute value as a number, or the default value if conversion did not succeed or attribute is empty
int as_int(int def = 0) const;
unsigned int as_uint(unsigned int def = 0) const;
double as_double(double def = 0) const;
float as_float(float def = 0) const;
#ifdef PUGIXML_HAS_LONG_LONG
long long as_llong(long long def = 0) const;
unsigned long long as_ullong(unsigned long long def = 0) const;
#endif
// Get attribute value as bool (returns true if first character is in '1tTyY' set), or the default value if attribute is empty
bool as_bool(bool def = false) const;
// Set attribute name/value (returns false if attribute is empty or there is not enough memory)
bool set_name(string_view_t rhs, bool shallow_copy = false);
bool set_value(string_view_t rhs, bool shallow_copy = false);
// Set attribute value with type conversion (numbers are converted to strings, boolean is converted to "true"/"false")
bool set_value(int rhs);
bool set_value(unsigned int rhs);
bool set_value(long rhs);
bool set_value(unsigned long rhs);
bool set_value(double rhs);
bool set_value(double rhs, int precision);
bool set_value(float rhs);
bool set_value(float rhs, int precision);
bool set_value(boolean rhs);
#ifdef PUGIXML_HAS_LONG_LONG
bool set_value(long long rhs);
bool set_value(unsigned long long rhs);
#endif
// Set attribute value (equivalent to set_value without error checking)
xml_attribute& operator=(string_view_t rhs);
xml_attribute& operator=(int rhs);
xml_attribute& operator=(unsigned int rhs);
xml_attribute& operator=(long rhs);
xml_attribute& operator=(unsigned long rhs);
xml_attribute& operator=(double rhs);
xml_attribute& operator=(float rhs);
xml_attribute& operator=(boolean rhs);
#ifdef PUGIXML_HAS_LONG_LONG
xml_attribute& operator=(long long rhs);
xml_attribute& operator=(unsigned long long rhs);
#endif
// Get next/previous attribute in the attribute list of the parent node
xml_attribute next_attribute() const;
xml_attribute previous_attribute() const;
// Get hash value (unique for handles to the same object)
size_t hash_value() const;
// Get internal pointer
xml_attribute_struct* internal_object() const;
};
#ifdef __BORLANDC__
// Borland C++ workaround
bool PUGIXML_FUNCTION operator&&(const xml_attribute& lhs, bool rhs);
bool PUGIXML_FUNCTION operator||(const xml_attribute& lhs, bool rhs);
#endif
// A light-weight handle for manipulating nodes in DOM tree
class PUGIXML_CLASS xml_node
{
friend class xml_attribute_iterator;
friend class xml_node_iterator;
friend class xml_named_node_iterator;
protected:
xml_node_struct* _root;
typedef void (*unspecified_bool_type)(xml_node***);
public:
// Default constructor. Constructs an empty node.
xml_node();
// Constructs node from internal pointer
explicit xml_node(xml_node_struct* p);
// Safe bool conversion operator
operator unspecified_bool_type() const;
// Borland C++ workaround
bool operator!() const;
// Comparison operators (compares wrapped node pointers)
bool operator==(const xml_node& r) const;
bool operator!=(const xml_node& r) const;
bool operator<(const xml_node& r) const;
bool operator>(const xml_node& r) const;
bool operator<=(const xml_node& r) const;
bool operator>=(const xml_node& r) const;
// Check if node is empty.
bool empty() const;
// Get node type
xml_node_type type() const;
// Get node name, or "" if node is empty or it has no name
string_view_t name() const;
// Get node value, or "" if node is empty or it has no value
// Note: For <node>text</node> node.value() does not return "text"! Use child_value() or text() methods to access text inside nodes.
string_view_t value() const;
// Get attribute list
xml_attribute first_attribute() const;
xml_attribute last_attribute() const;
// Get children list
xml_node first_child() const;
xml_node last_child() const;
// Get next/previous sibling in the children list of the parent node
xml_node next_sibling() const;
xml_node previous_sibling() const;
// Get parent node
xml_node parent() const;
// Get root of DOM tree this node belongs to
xml_node root() const;
// Get text object for the current node
xml_text text() const;
// Get child, attribute or next/previous sibling with the specified name
xml_node child(string_view_t name) const;
xml_attribute attribute(string_view_t name) const;
xml_node next_sibling(string_view_t name) const;
xml_node previous_sibling(string_view_t name) const;
// Get attribute, starting the search from a hint (and updating hint so that searching for a sequence of attributes is fast)
xml_attribute attribute(string_view_t name, xml_attribute& hint) const;
// Get child value of current node; that is, value of the first child node of type PCDATA/CDATA
string_view_t child_value() const;
// Get child value of child with specified name. Equivalent to child(name).child_value().
string_view_t child_value(string_view_t name) const;
// Set node name/value (returns false if node is empty, there is not enough memory, or node can not have name/value)
bool set_name(string_view_t rhs, bool shallow_copy = false);
bool set_value(string_view_t rhs, bool shallow_copy = false);
// Add attribute with specified name. Returns added attribute, or empty attribute on errors.
xml_attribute append_attribute(string_view_t name, bool shallow_copy = false);
xml_attribute prepend_attribute(string_view_t name, bool shallow_copy = false);
xml_attribute insert_attribute_after(string_view_t name, const xml_attribute& attr, bool shallow_copy = false);
xml_attribute insert_attribute_before(string_view_t name, const xml_attribute& attr, bool shallow_copy = false);
// Add a copy of the specified attribute. Returns added attribute, or empty attribute on errors.
xml_attribute append_copy(const xml_attribute& proto);
xml_attribute prepend_copy(const xml_attribute& proto);
xml_attribute insert_copy_after(const xml_attribute& proto, const xml_attribute& attr);
xml_attribute insert_copy_before(const xml_attribute& proto, const xml_attribute& attr);
// Add child node with specified type. Returns added node, or empty node on errors.
xml_node append_child(xml_node_type type = node_element);
xml_node prepend_child(xml_node_type type = node_element);
xml_node insert_child_after(xml_node_type type, const xml_node& node);
xml_node insert_child_before(xml_node_type type, const xml_node& node);
// Add child element with specified name. Returns added node, or empty node on errors.
xml_node append_child(string_view_t name, bool shallow_copy = false);
xml_node prepend_child(string_view_t name, bool shallow_copy = false);
xml_node insert_child_after(string_view_t name, const xml_node& node, bool shallow_copy = false);
xml_node insert_child_before(string_view_t name, const xml_node& node, bool shallow_copy = false);
// Add a copy of the specified node as a child. Returns added node, or empty node on errors.
xml_node append_copy(const xml_node& proto);
xml_node prepend_copy(const xml_node& proto);
xml_node insert_copy_after(const xml_node& proto, const xml_node& node);
xml_node insert_copy_before(const xml_node& proto, const xml_node& node);
// Move the specified node to become a child of this node. Returns moved node, or empty node on errors.
xml_node append_move(const xml_node& moved);
xml_node prepend_move(const xml_node& moved);
xml_node insert_move_after(const xml_node& moved, const xml_node& node);
xml_node insert_move_before(const xml_node& moved, const xml_node& node);
// Remove specified attribute
bool remove_attribute(const xml_attribute& a);
bool remove_attribute(string_view_t name);
// Remove all attributes
bool remove_attributes();
// Remove specified child
bool remove_child(const xml_node& n);
bool remove_child(string_view_t name);
// Remove all children
bool remove_children();
// Parses buffer as an XML document fragment and appends all nodes as children of the current node.
// Copies/converts the buffer, so it may be deleted or changed after the function returns.
// Note: append_buffer allocates memory that has the lifetime of the owning document; removing the appended nodes does not immediately reclaim that memory.
xml_parse_result append_buffer(const void* contents, size_t size, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
// Find attribute using predicate. Returns first attribute for which predicate returned true.
template <typename Predicate> xml_attribute find_attribute(Predicate pred) const
{
if (!_root) return xml_attribute();
for (xml_attribute attrib = first_attribute(); attrib; attrib = attrib.next_attribute())
if (pred(attrib))
return attrib;
return xml_attribute();
}
// Find child node using predicate. Returns first child for which predicate returned true.
template <typename Predicate> xml_node find_child(Predicate pred) const
{
if (!_root) return xml_node();
for (xml_node node = first_child(); node; node = node.next_sibling())
if (pred(node))
return node;
return xml_node();
}
// Find node from subtree using predicate. Returns first node from subtree (depth-first), for which predicate returned true.
template <typename Predicate> xml_node find_node(Predicate pred) const
{
if (!_root) return xml_node();
xml_node cur = first_child();
while (cur._root && cur._root != _root)
{
if (pred(cur)) return cur;
if (cur.first_child()) cur = cur.first_child();
else if (cur.next_sibling()) cur = cur.next_sibling();
else
{
while (!cur.next_sibling() && cur._root != _root) cur = cur.parent();
if (cur._root != _root) cur = cur.next_sibling();
}
}
return xml_node();
}
// Find child node by attribute name/value
xml_node find_child_by_attribute(string_view_t name, string_view_t attr_name, string_view_t attr_value) const;
xml_node find_child_by_attribute(string_view_t attr_name, string_view_t attr_value) const;
#ifndef PUGIXML_NO_STL
// Get the absolute node path from root as a text string.
string_t path(char_t delimiter = '/') const;
#endif
// Search for a node by path consisting of node names and . or .. elements.
xml_node first_element_by_path(const char_t* path, char_t delimiter = '/') const;
// Recursively traverse subtree with xml_tree_walker
bool traverse(xml_tree_walker& walker);
#ifndef PUGIXML_NO_XPATH
// Select single node by evaluating XPath query. Returns first node from the resulting node set.
xpath_node select_node(const char_t* query, xpath_variable_set* variables = PUGIXML_NULL) const;
xpath_node select_node(const xpath_query& query) const;
// Select node set by evaluating XPath query
xpath_node_set select_nodes(const char_t* query, xpath_variable_set* variables = PUGIXML_NULL) const;
xpath_node_set select_nodes(const xpath_query& query) const;
// (deprecated: use select_node instead) Select single node by evaluating XPath query.
PUGIXML_DEPRECATED xpath_node select_single_node(const char_t* query, xpath_variable_set* variables = PUGIXML_NULL) const;
PUGIXML_DEPRECATED xpath_node select_single_node(const xpath_query& query) const;
#endif
// Print subtree using a writer object
void print(xml_writer& writer, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto, unsigned int depth = 0) const;
#ifndef PUGIXML_NO_STL
// Print subtree to stream
void print(std::basic_ostream<char, std::char_traits<char> >& os, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto, unsigned int depth = 0) const;
void print(std::basic_ostream<wchar_t, std::char_traits<wchar_t> >& os, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, unsigned int depth = 0) const;
#endif
// Child nodes iterators
typedef xml_node_iterator iterator;
iterator begin() const;
iterator end() const;
// Attribute iterators
typedef xml_attribute_iterator attribute_iterator;
attribute_iterator attributes_begin() const;
attribute_iterator attributes_end() const;
// Range-based for support
xml_object_range<xml_node_iterator> children() const;
xml_object_range<xml_named_node_iterator> children(string_view_t name) const;
xml_object_range<xml_attribute_iterator> attributes() const;
// Get node offset in parsed file/string (in char_t units) for debugging purposes
ptrdiff_t offset_debug() const;
// Get hash value (unique for handles to the same object)
size_t hash_value() const;
// Get internal pointer
xml_node_struct* internal_object() const;
};
#ifdef __BORLANDC__
// Borland C++ workaround
bool PUGIXML_FUNCTION operator&&(const xml_node& lhs, bool rhs);
bool PUGIXML_FUNCTION operator||(const xml_node& lhs, bool rhs);
#endif
// A helper for working with text inside PCDATA nodes
class PUGIXML_CLASS xml_text
{
friend class xml_node;
xml_node_struct* _root;
typedef void (*unspecified_bool_type)(xml_text***);
explicit xml_text(xml_node_struct* root);
xml_node_struct* _data_new();
xml_node_struct* _data() const;
public:
// Default constructor. Constructs an empty object.
xml_text();
// Safe bool conversion operator
operator unspecified_bool_type() const;
// Borland C++ workaround
bool operator!() const;
// Check if text object is empty
bool empty() const;
// Get text, or "" if object is empty
string_view_t get() const;
// Get text, or the default value if object is empty
string_view_t as_string(string_view_t def = PUGIXML_EMPTY_SV) const;
// Get text as a number, or the default value if conversion did not succeed or object is empty
int as_int(int def = 0) const;
unsigned int as_uint(unsigned int def = 0) const;
double as_double(double def = 0) const;
float as_float(float def = 0) const;
#ifdef PUGIXML_HAS_LONG_LONG
long long as_llong(long long def = 0) const;
unsigned long long as_ullong(unsigned long long def = 0) const;
#endif
// Get text as bool (returns true if first character is in '1tTyY' set), or the default value if object is empty
bool as_bool(bool def = false) const;
// Set text (returns false if object is empty or there is not enough memory)
bool set(string_view_t rhs, bool shallow_copy = false);
// Set text with type conversion (numbers are converted to strings, boolean is converted to "true"/"false")
bool set(int rhs);
bool set(unsigned int rhs);
bool set(long rhs);
bool set(unsigned long rhs);
bool set(double rhs);
bool set(double rhs, int precision);
bool set(float rhs);
bool set(float rhs, int precision);
bool set(boolean rhs);
#ifdef PUGIXML_HAS_LONG_LONG
bool set(long long rhs);
bool set(unsigned long long rhs);
#endif
// Set text (equivalent to set without error checking)
xml_text& operator=(string_view_t rhs);
xml_text& operator=(int rhs);
xml_text& operator=(unsigned int rhs);
xml_text& operator=(long rhs);
xml_text& operator=(unsigned long rhs);
xml_text& operator=(double rhs);
xml_text& operator=(float rhs);
xml_text& operator=(boolean rhs);
#ifdef PUGIXML_HAS_LONG_LONG
xml_text& operator=(long long rhs);
xml_text& operator=(unsigned long long rhs);
#endif
// Get the data node (node_pcdata or node_cdata) for this object
xml_node data() const;
};
#ifdef __BORLANDC__
// Borland C++ workaround
bool PUGIXML_FUNCTION operator&&(const xml_text& lhs, bool rhs);
bool PUGIXML_FUNCTION operator||(const xml_text& lhs, bool rhs);
#endif
// Child node iterator (a bidirectional iterator over a collection of xml_node)
class PUGIXML_CLASS xml_node_iterator
{
friend class xml_node;
private:
mutable xml_node _wrap;
xml_node _parent;
xml_node_iterator(xml_node_struct* ref, xml_node_struct* parent);
public:
// Iterator traits
typedef ptrdiff_t difference_type;
typedef xml_node value_type;
typedef xml_node* pointer;
typedef xml_node& reference;
#ifndef PUGIXML_NO_STL
typedef std::bidirectional_iterator_tag iterator_category;
#endif
// Default constructor
xml_node_iterator();
// Construct an iterator which points to the specified node
xml_node_iterator(const xml_node& node);
// Iterator operators
bool operator==(const xml_node_iterator& rhs) const;
bool operator!=(const xml_node_iterator& rhs) const;
xml_node& operator*() const;
xml_node* operator->() const;
xml_node_iterator& operator++();
xml_node_iterator operator++(int);
xml_node_iterator& operator--();
xml_node_iterator operator--(int);
};
// Attribute iterator (a bidirectional iterator over a collection of xml_attribute)
class PUGIXML_CLASS xml_attribute_iterator
{
friend class xml_node;
private:
mutable xml_attribute _wrap;
xml_node _parent;
xml_attribute_iterator(xml_attribute_struct* ref, xml_node_struct* parent);
public:
// Iterator traits
typedef ptrdiff_t difference_type;
typedef xml_attribute value_type;
typedef xml_attribute* pointer;
typedef xml_attribute& reference;
#ifndef PUGIXML_NO_STL
typedef std::bidirectional_iterator_tag iterator_category;
#endif
// Default constructor
xml_attribute_iterator();
// Construct an iterator which points to the specified attribute
xml_attribute_iterator(const xml_attribute& attr, const xml_node& parent);
// Iterator operators
bool operator==(const xml_attribute_iterator& rhs) const;
bool operator!=(const xml_attribute_iterator& rhs) const;
xml_attribute& operator*() const;
xml_attribute* operator->() const;
xml_attribute_iterator& operator++();
xml_attribute_iterator operator++(int);
xml_attribute_iterator& operator--();
xml_attribute_iterator operator--(int);
};
// Named node range helper
class PUGIXML_CLASS xml_named_node_iterator
{
friend class xml_node;
public:
// Iterator traits
typedef ptrdiff_t difference_type;
typedef xml_node value_type;
typedef xml_node* pointer;
typedef xml_node& reference;
#ifndef PUGIXML_NO_STL
typedef std::bidirectional_iterator_tag iterator_category;
#endif
// Default constructor
xml_named_node_iterator();
// Construct an iterator which points to the specified node
xml_named_node_iterator(const xml_node& node, string_view_t name);
// Iterator operators
bool operator==(const xml_named_node_iterator& rhs) const;
bool operator!=(const xml_named_node_iterator& rhs) const;
xml_node& operator*() const;
xml_node* operator->() const;
xml_named_node_iterator& operator++();
xml_named_node_iterator operator++(int);
xml_named_node_iterator& operator--();
xml_named_node_iterator operator--(int);
private:
mutable xml_node _wrap;
xml_node _parent;
const char_t* _name;
int _name_len;
xml_named_node_iterator(xml_node_struct* ref, xml_node_struct* parent, string_view_t name);
};
// Abstract tree walker class (see xml_node::traverse)
class PUGIXML_CLASS xml_tree_walker
{
friend class xml_node;
private:
int _depth;
protected:
// Get current traversal depth
int depth() const;
public:
xml_tree_walker();
virtual ~xml_tree_walker();
// Callback that is called when traversal begins
virtual bool begin(xml_node& node);
// Callback that is called for each node traversed
virtual bool for_each(xml_node& node) = 0;
// Callback that is called when traversal ends
virtual bool end(xml_node& node);
};
// Parsing status, returned as part of xml_parse_result object
enum xml_parse_status
{
status_ok = 0, // No error
status_file_not_found, // File was not found during load_file()
status_io_error, // Error reading from file/stream
status_out_of_memory, // Could not allocate memory
status_internal_error, // Internal error occurred
status_unrecognized_tag, // Parser could not determine tag type
status_bad_pi, // Parsing error occurred while parsing document declaration/processing instruction
status_bad_comment, // Parsing error occurred while parsing comment
status_bad_cdata, // Parsing error occurred while parsing CDATA section
status_bad_doctype, // Parsing error occurred while parsing document type declaration
status_bad_pcdata, // Parsing error occurred while parsing PCDATA section
status_bad_start_element, // Parsing error occurred while parsing start element tag
status_bad_attribute, // Parsing error occurred while parsing element attribute
status_bad_end_element, // Parsing error occurred while parsing end element tag
status_end_element_mismatch,// There was a mismatch of start-end tags (closing tag had incorrect name, some tag was not closed or there was an excessive closing tag)
status_append_invalid_root, // Unable to append nodes since root type is not node_element or node_document (exclusive to xml_node::append_buffer)
status_no_document_element // Parsing resulted in a document without element nodes
};
// Parsing result
struct PUGIXML_CLASS xml_parse_result
{
// Parsing status (see xml_parse_status)
xml_parse_status status;
// Last parsed offset (in char_t units from start of input data)
ptrdiff_t offset;
// Source document encoding
xml_encoding encoding;
// Default constructor, initializes object to failed state
xml_parse_result();
// Cast to bool operator
operator bool() const;
// Get error description
const char* description() const;
};
// Document class (DOM tree root)
class PUGIXML_CLASS xml_document: public xml_node
{
private:
char_t* _buffer;
char _memory[192];
// Non-copyable semantics
xml_document(const xml_document&);
xml_document& operator=(const xml_document&);
void _create();
void _destroy();
void _move(xml_document& rhs) PUGIXML_NOEXCEPT_IF_NOT_COMPACT;
public:
// Default constructor, makes empty document
xml_document();
// Destructor, invalidates all node/attribute handles to this document
~xml_document();
#ifdef PUGIXML_HAS_MOVE
// Move semantics support
xml_document(xml_document&& rhs) PUGIXML_NOEXCEPT_IF_NOT_COMPACT;
xml_document& operator=(xml_document&& rhs) PUGIXML_NOEXCEPT_IF_NOT_COMPACT;
#endif
// Removes all nodes, leaving the empty document
void reset();
// Removes all nodes, then copies the entire contents of the specified document
void reset(const xml_document& proto);
#ifndef PUGIXML_NO_STL
// Load document from stream.
xml_parse_result load(std::basic_istream<char, std::char_traits<char> >& stream, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
xml_parse_result load(std::basic_istream<wchar_t, std::char_traits<wchar_t> >& stream, unsigned int options = parse_default);
#endif
// (deprecated: use load_string instead) Load document from zero-terminated string. No encoding conversions are applied.
PUGIXML_DEPRECATED xml_parse_result load(const char_t* contents, unsigned int options = parse_default);
// Load document from zero-terminated string. No encoding conversions are applied.
xml_parse_result load_string(const char_t* contents, unsigned int options = parse_default);
// Load document from file
xml_parse_result load_file(const char* path, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
xml_parse_result load_file(const wchar_t* path, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
// Load document from buffer. Copies/converts the buffer, so it may be deleted or changed after the function returns.
xml_parse_result load_buffer(const void* contents, size_t size, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
// Load document from buffer, using the buffer for in-place parsing (the buffer is modified and used for storage of document data).
// You should ensure that buffer data will persist throughout the document's lifetime, and free the buffer memory manually once document is destroyed.
xml_parse_result load_buffer_inplace(void* contents, size_t size, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
// Load document from buffer, using the buffer for in-place parsing (the buffer is modified and used for storage of document data).
// You should allocate the buffer with pugixml allocation function; document will free the buffer when it is no longer needed (you can't use it anymore).
xml_parse_result load_buffer_inplace_own(void* contents, size_t size, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
// Save XML document to writer (semantics is slightly different from xml_node::print, see documentation for details).
void save(xml_writer& writer, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const;
#ifndef PUGIXML_NO_STL
// Save XML document to stream (semantics is slightly different from xml_node::print, see documentation for details).
void save(std::basic_ostream<char, std::char_traits<char> >& stream, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const;
void save(std::basic_ostream<wchar_t, std::char_traits<wchar_t> >& stream, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default) const;
#endif
// Save XML to file
bool save_file(const char* path, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const;
bool save_file(const wchar_t* path, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const;
// Get document element
xml_node document_element() const;
};
#ifndef PUGIXML_NO_XPATH
// XPath query return type
enum xpath_value_type
{
xpath_type_none, // Unknown type (query failed to compile)
xpath_type_node_set, // Node set (xpath_node_set)
xpath_type_number, // Number
xpath_type_string, // String
xpath_type_boolean // Boolean
};
// XPath parsing result
struct PUGIXML_CLASS xpath_parse_result
{
// Error message (0 if no error)
const char* error;
// Last parsed offset (in char_t units from string start)
ptrdiff_t offset;
// Default constructor, initializes object to failed state
xpath_parse_result();
// Cast to bool operator
operator bool() const;
// Get error description
const char* description() const;
};
// A single XPath variable
class PUGIXML_CLASS xpath_variable
{
friend class xpath_variable_set;
protected:
xpath_value_type _type;
xpath_variable* _next;
xpath_variable(xpath_value_type type);
// Non-copyable semantics
xpath_variable(const xpath_variable&);
xpath_variable& operator=(const xpath_variable&);
public:
// Get variable name
const char_t* name() const;
// Get variable type
xpath_value_type type() const;
// Get variable value; no type conversion is performed, default value (false, NaN, empty string, empty node set) is returned on type mismatch error
bool get_boolean() const;
double get_number() const;
const char_t* get_string() const;
const xpath_node_set& get_node_set() const;
// Set variable value; no type conversion is performed, false is returned on type mismatch error
bool set(bool value);
bool set(double value);
bool set(const char_t* value);
bool set(const xpath_node_set& value);
};
// A set of XPath variables
class PUGIXML_CLASS xpath_variable_set
{
private:
xpath_variable* _data[64];
void _assign(const xpath_variable_set& rhs);
void _swap(xpath_variable_set& rhs);
xpath_variable* _find(const char_t* name) const;
static bool _clone(xpath_variable* var, xpath_variable** out_result);
static void _destroy(xpath_variable* var);
public:
// Default constructor/destructor
xpath_variable_set();
~xpath_variable_set();
// Copy constructor/assignment operator
xpath_variable_set(const xpath_variable_set& rhs);
xpath_variable_set& operator=(const xpath_variable_set& rhs);
#ifdef PUGIXML_HAS_MOVE
// Move semantics support
xpath_variable_set(xpath_variable_set&& rhs) PUGIXML_NOEXCEPT;
xpath_variable_set& operator=(xpath_variable_set&& rhs) PUGIXML_NOEXCEPT;
#endif
// Add a new variable or get the existing one, if the types match
xpath_variable* add(const char_t* name, xpath_value_type type);
// Set value of an existing variable; no type conversion is performed, false is returned if there is no such variable or if types mismatch
bool set(const char_t* name, bool value);
bool set(const char_t* name, double value);
bool set(const char_t* name, const char_t* value);
bool set(const char_t* name, const xpath_node_set& value);
// Get existing variable by name
xpath_variable* get(const char_t* name);
const xpath_variable* get(const char_t* name) const;
};
// A compiled XPath query object
class PUGIXML_CLASS xpath_query
{
private:
void* _impl;
xpath_parse_result _result;
typedef void (*unspecified_bool_type)(xpath_query***);
// Non-copyable semantics
xpath_query(const xpath_query&);
xpath_query& operator=(const xpath_query&);
public:
// Construct a compiled object from XPath expression.
// If PUGIXML_NO_EXCEPTIONS is not defined, throws xpath_exception on compilation errors.
explicit xpath_query(const char_t* query, xpath_variable_set* variables = PUGIXML_NULL);
// Constructor
xpath_query();
// Destructor
~xpath_query();
#ifdef PUGIXML_HAS_MOVE
// Move semantics support
xpath_query(xpath_query&& rhs) PUGIXML_NOEXCEPT;
xpath_query& operator=(xpath_query&& rhs) PUGIXML_NOEXCEPT;
#endif
// Get query expression return type
xpath_value_type return_type() const;
// Evaluate expression as boolean value in the specified context; performs type conversion if necessary.
// If PUGIXML_NO_EXCEPTIONS is not defined, throws std::bad_alloc on out of memory errors.
bool evaluate_boolean(const xpath_node& n) const;
// Evaluate expression as double value in the specified context; performs type conversion if necessary.
// If PUGIXML_NO_EXCEPTIONS is not defined, throws std::bad_alloc on out of memory errors.
double evaluate_number(const xpath_node& n) const;
#ifndef PUGIXML_NO_STL
// Evaluate expression as string value in the specified context; performs type conversion if necessary.
// If PUGIXML_NO_EXCEPTIONS is not defined, throws std::bad_alloc on out of memory errors.
string_t evaluate_string(const xpath_node& n) const;
#endif
// Evaluate expression as string value in the specified context; performs type conversion if necessary.
// At most capacity characters are written to the destination buffer, full result size is returned (includes terminating zero).
// If PUGIXML_NO_EXCEPTIONS is not defined, throws std::bad_alloc on out of memory errors.
// If PUGIXML_NO_EXCEPTIONS is defined, returns empty set instead.
size_t evaluate_string(char_t* buffer, size_t capacity, const xpath_node& n) const;
// Evaluate expression as node set in the specified context.
// If PUGIXML_NO_EXCEPTIONS is not defined, throws xpath_exception on type mismatch and std::bad_alloc on out of memory errors.
// If PUGIXML_NO_EXCEPTIONS is defined, returns empty node set instead.
xpath_node_set evaluate_node_set(const xpath_node& n) const;
// Evaluate expression as node set in the specified context.
// Return first node in document order, or empty node if node set is empty.
// If PUGIXML_NO_EXCEPTIONS is not defined, throws xpath_exception on type mismatch and std::bad_alloc on out of memory errors.
// If PUGIXML_NO_EXCEPTIONS is defined, returns empty node instead.
xpath_node evaluate_node(const xpath_node& n) const;
// Get parsing result (used to get compilation errors in PUGIXML_NO_EXCEPTIONS mode)
const xpath_parse_result& result() const;
// Safe bool conversion operator
operator unspecified_bool_type() const;
// Borland C++ workaround
bool operator!() const;
};
#ifndef PUGIXML_NO_EXCEPTIONS
#if defined(_MSC_VER)
// C4275 can be ignored in Visual C++ if you are deriving
// from a type in the Standard C++ Library
#pragma warning(push)
#pragma warning(disable: 4275)
#endif
// XPath exception class
class PUGIXML_CLASS xpath_exception: public std::exception
{
private:
xpath_parse_result _result;
public:
// Construct exception from parse result
explicit xpath_exception(const xpath_parse_result& result);
// Get error message
virtual const char* what() const throw() PUGIXML_OVERRIDE;
// Get parse result
const xpath_parse_result& result() const;
};
#if defined(_MSC_VER)
#pragma warning(pop)
#endif
#endif
// XPath node class (either xml_node or xml_attribute)
class PUGIXML_CLASS xpath_node
{
private:
xml_node _node;
xml_attribute _attribute;
typedef void (*unspecified_bool_type)(xpath_node***);
public:
// Default constructor; constructs empty XPath node
xpath_node();
// Construct XPath node from XML node/attribute
xpath_node(const xml_node& node);
xpath_node(const xml_attribute& attribute, const xml_node& parent);
// Get node/attribute, if any
xml_node node() const;
xml_attribute attribute() const;
// Get parent of contained node/attribute
xml_node parent() const;
// Safe bool conversion operator
operator unspecified_bool_type() const;
// Borland C++ workaround
bool operator!() const;
// Comparison operators
bool operator==(const xpath_node& n) const;
bool operator!=(const xpath_node& n) const;
};
#ifdef __BORLANDC__
// Borland C++ workaround
bool PUGIXML_FUNCTION operator&&(const xpath_node& lhs, bool rhs);
bool PUGIXML_FUNCTION operator||(const xpath_node& lhs, bool rhs);
#endif
// A fixed-size collection of XPath nodes
class PUGIXML_CLASS xpath_node_set
{
public:
// Collection type
enum type_t
{
type_unsorted, // Not ordered
type_sorted, // Sorted by document order (ascending)
type_sorted_reverse // Sorted by document order (descending)
};
// Constant iterator type
typedef const xpath_node* const_iterator;
// We define non-constant iterator to be the same as constant iterator so that various generic algorithms (i.e. boost foreach) work
typedef const xpath_node* iterator;
// Default constructor. Constructs empty set.
xpath_node_set();
// Constructs a set from iterator range; data is not checked for duplicates and is not sorted according to provided type, so be careful
xpath_node_set(const_iterator begin, const_iterator end, type_t type = type_unsorted);
// Destructor
~xpath_node_set();
// Copy constructor/assignment operator
xpath_node_set(const xpath_node_set& ns);
xpath_node_set& operator=(const xpath_node_set& ns);
#ifdef PUGIXML_HAS_MOVE
// Move semantics support
xpath_node_set(xpath_node_set&& rhs) PUGIXML_NOEXCEPT;
xpath_node_set& operator=(xpath_node_set&& rhs) PUGIXML_NOEXCEPT;
#endif
// Get collection type
type_t type() const;
// Get collection size
size_t size() const;
// Indexing operator
const xpath_node& operator[](size_t index) const;
// Collection iterators
const_iterator begin() const;
const_iterator end() const;
// Sort the collection in ascending/descending order by document order
void sort(bool reverse = false);
// Get first node in the collection by document order
xpath_node first() const;
// Check if collection is empty
bool empty() const;
private:
type_t _type;
xpath_node _storage[1];
xpath_node* _begin;
xpath_node* _end;
void _assign(const_iterator begin, const_iterator end, type_t type);
void _move(xpath_node_set& rhs) PUGIXML_NOEXCEPT;
};
#endif
#ifndef PUGIXML_NO_STL
// Convert wide string to UTF8
std::basic_string<char, std::char_traits<char>, std::allocator<char> > PUGIXML_FUNCTION as_utf8(const wchar_t* str);
std::basic_string<char, std::char_traits<char>, std::allocator<char> > PUGIXML_FUNCTION as_utf8(const std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >& str);
// Convert UTF8 to wide string
std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > PUGIXML_FUNCTION as_wide(const char* str);
std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > PUGIXML_FUNCTION as_wide(const std::basic_string<char, std::char_traits<char>, std::allocator<char> >& str);
#endif
// Memory allocation function interface; returns pointer to allocated memory or NULL on failure
typedef void* (*allocation_function)(size_t size);
// Memory deallocation function interface
typedef void (*deallocation_function)(void* ptr);
// Override default memory management functions. All subsequent allocations/deallocations will be performed via supplied functions.
void PUGIXML_FUNCTION set_memory_management_functions(allocation_function allocate, deallocation_function deallocate);
// Get current memory management functions
allocation_function PUGIXML_FUNCTION get_memory_allocation_function();
deallocation_function PUGIXML_FUNCTION get_memory_deallocation_function();
}
#if !defined(PUGIXML_NO_STL) && (defined(_MSC_VER) || defined(__ICC))
namespace std
{
// Workarounds for (non-standard) iterator category detection for older versions (MSVC7/IC8 and earlier)
std::bidirectional_iterator_tag PUGIXML_FUNCTION _Iter_cat(const pugi::xml_node_iterator&);
std::bidirectional_iterator_tag PUGIXML_FUNCTION _Iter_cat(const pugi::xml_attribute_iterator&);
std::bidirectional_iterator_tag PUGIXML_FUNCTION _Iter_cat(const pugi::xml_named_node_iterator&);
}
#endif
#if !defined(PUGIXML_NO_STL) && defined(__SUNPRO_CC)
namespace std
{
// Workarounds for (non-standard) iterator category detection
std::bidirectional_iterator_tag PUGIXML_FUNCTION __iterator_category(const pugi::xml_node_iterator&);
std::bidirectional_iterator_tag PUGIXML_FUNCTION __iterator_category(const pugi::xml_attribute_iterator&);
std::bidirectional_iterator_tag PUGIXML_FUNCTION __iterator_category(const pugi::xml_named_node_iterator&);
}
#endif
#endif
// Make sure implementation is included in header-only mode
// Use macro expansion in #include to work around QMake (QTBUG-11923)
#if defined(PUGIXML_HEADER_ONLY) && !defined(PUGIXML_SOURCE)
# define PUGIXML_SOURCE "pugixml.cpp"
# include PUGIXML_SOURCE
#endif
/**
* Copyright (c) 2006-2020 Arseny Kapoulkine
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
|
object_const_def ; object_event constants
PokemonCommunicationCenter_MapScripts:
db 0 ; scene scripts
db 0 ; callbacks
PokemonCommunicationCenter_MapEvents:
db 0, 0 ; filler
db 2 ; warp events
warp_event 6, 15, JUBILIFE_CITY, 9
warp_event 7, 15, JUBILIFE_CITY, 9
db 0 ; coord events
db 0 ; bg events
db 0 ; object events
|
// Copyright (c) 2012-2013 The Bitcoin Core developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "utilstrencodings.h"
#include "test/test_Zenon.h"
#include <boost/test/unit_test.hpp>
BOOST_FIXTURE_TEST_SUITE(base32_tests, BasicTestingSetup)
BOOST_AUTO_TEST_CASE(base32_testvectors)
{
static const std::string vstrIn[] = {"","f","fo","foo","foob","fooba","foobar"};
static const std::string vstrOut[] = {"","my======","mzxq====","mzxw6===","mzxw6yq=","mzxw6ytb","mzxw6ytboi======"};
for (unsigned int i=0; i<sizeof(vstrIn)/sizeof(vstrIn[0]); i++)
{
std::string strEnc = EncodeBase32(vstrIn[i]);
BOOST_CHECK(strEnc == vstrOut[i]);
std::string strDec = DecodeBase32(vstrOut[i]);
BOOST_CHECK(strDec == vstrIn[i]);
}
}
BOOST_AUTO_TEST_SUITE_END()
|
; Licensed to the .NET Foundation under one or more agreements.
; The .NET Foundation licenses this file to you under the MIT license.
; See the LICENSE file in the project root for more information.
;; ==++==
;;
;;
;; ==--==
#include "ksarm64.h"
#include "asmconstants.h"
#include "asmmacros.h"
#ifdef FEATURE_PREJIT
IMPORT VirtualMethodFixupWorker
IMPORT StubDispatchFixupWorker
#endif
IMPORT ExternalMethodFixupWorker
IMPORT PreStubWorker
IMPORT NDirectImportWorker
IMPORT VSD_ResolveWorker
IMPORT JIT_InternalThrow
IMPORT ComPreStubWorker
IMPORT COMToCLRWorker
IMPORT CallDescrWorkerUnwindFrameChainHandler
IMPORT UMEntryPrestubUnwindFrameChainHandler
IMPORT UMThunkStubUnwindFrameChainHandler
IMPORT TheUMEntryPrestubWorker
IMPORT CreateThreadBlockThrow
IMPORT UMThunkStubRareDisableWorker
IMPORT GetCurrentSavedRedirectContext
IMPORT LinkFrameAndThrow
IMPORT FixContextHandler
IMPORT OnHijackWorker
#ifdef FEATURE_READYTORUN
IMPORT DynamicHelperWorker
#endif
IMPORT ObjIsInstanceOfNoGC
IMPORT ArrayStoreCheck
SETALIAS g_pObjectClass, ?g_pObjectClass@@3PEAVMethodTable@@EA
IMPORT $g_pObjectClass
#ifdef FEATURE_USE_SOFTWARE_WRITE_WATCH_FOR_GC_HEAP
IMPORT g_sw_ww_table
#endif
#ifdef FEATURE_MANUALLY_MANAGED_CARD_BUNDLES
IMPORT g_card_bundle_table
#endif
IMPORT g_ephemeral_low
IMPORT g_ephemeral_high
IMPORT g_lowest_address
IMPORT g_highest_address
IMPORT g_card_table
IMPORT g_TrapReturningThreads
IMPORT g_dispatch_cache_chain_success_counter
#ifdef WRITE_BARRIER_CHECK
SETALIAS g_GCShadow, ?g_GCShadow@@3PEAEEA
SETALIAS g_GCShadowEnd, ?g_GCShadowEnd@@3PEAEEA
IMPORT g_lowest_address
IMPORT $g_GCShadow
IMPORT $g_GCShadowEnd
#endif // WRITE_BARRIER_CHECK
IMPORT JIT_GetSharedNonGCStaticBase_Helper
IMPORT JIT_GetSharedGCStaticBase_Helper
#ifdef FEATURE_COMINTEROP
IMPORT CLRToCOMWorker
#endif // FEATURE_COMINTEROP
TEXTAREA
;; LPVOID __stdcall GetCurrentIP(void);
LEAF_ENTRY GetCurrentIP
mov x0, lr
ret lr
LEAF_END
;; LPVOID __stdcall GetCurrentSP(void);
LEAF_ENTRY GetCurrentSP
mov x0, sp
ret lr
LEAF_END
;;-----------------------------------------------------------------------------
;; This routine captures the machine state. It is used by helper method frame
;;-----------------------------------------------------------------------------
;;void LazyMachStateCaptureState(struct LazyMachState *pState);
LEAF_ENTRY LazyMachStateCaptureState
;; marks that this is not yet valid
mov w1, #0
str w1, [x0, #MachState__isValid]
str lr, [x0, #LazyMachState_captureIp]
;; str instruction does not save sp register directly so move to temp register
mov x1, sp
str x1, [x0, #LazyMachState_captureSp]
;; save non-volatile registers that can contain object references
add x1, x0, #LazyMachState_captureX19_X29
stp x19, x20, [x1, #(16*0)]
stp x21, x22, [x1, #(16*1)]
stp x23, x24, [x1, #(16*2)]
stp x25, x26, [x1, #(16*3)]
stp x27, x28, [x1, #(16*4)]
str x29, [x1, #(16*5)]
ret lr
LEAF_END
;
; If a preserved register were pushed onto the stack between
; the managed caller and the H_M_F, ptrX19_X29 will point to its
; location on the stack and it would have been updated on the
; stack by the GC already and it will be popped back into the
; appropriate register when the appropriate epilog is run.
;
; Otherwise, the register is preserved across all the code
; in this HCALL or FCALL, so we need to update those registers
; here because the GC will have updated our copies in the
; frame.
;
; So, if ptrX19_X29 points into the MachState, we need to update
; the register here. That's what this macro does.
;
MACRO
RestoreRegMS $regIndex, $reg
; Incoming:
;
; x0 = address of MachState
;
; $regIndex: Index of the register (x19-x29). For x19, index is 19.
; For x20, index is 20, and so on.
;
; $reg: Register name (e.g. x19, x20, etc)
;
; Get the address of the specified captured register from machine state
add x2, x0, #(MachState__captureX19_X29 + (($regIndex-19)*8))
; Get the content of specified preserved register pointer from machine state
ldr x3, [x0, #(MachState__ptrX19_X29 + (($regIndex-19)*8))]
cmp x2, x3
bne %FT0
ldr $reg, [x2]
0
MEND
; EXTERN_C int __fastcall HelperMethodFrameRestoreState(
; INDEBUG_COMMA(HelperMethodFrame *pFrame)
; MachState *pState
; )
LEAF_ENTRY HelperMethodFrameRestoreState
#ifdef _DEBUG
mov x0, x1
#endif
; If machine state is invalid, then simply exit
ldr w1, [x0, #MachState__isValid]
cmp w1, #0
beq Done
RestoreRegMS 19, X19
RestoreRegMS 20, X20
RestoreRegMS 21, X21
RestoreRegMS 22, X22
RestoreRegMS 23, X23
RestoreRegMS 24, X24
RestoreRegMS 25, X25
RestoreRegMS 26, X26
RestoreRegMS 27, X27
RestoreRegMS 28, X28
RestoreRegMS 29, X29
Done
; Its imperative that the return value of HelperMethodFrameRestoreState is zero
; as it is used in the state machine to loop until it becomes zero.
; Refer to HELPER_METHOD_FRAME_END macro for details.
mov x0,#0
ret lr
LEAF_END
; ------------------------------------------------------------------
; The call in ndirect import precode points to this function.
NESTED_ENTRY NDirectImportThunk
PROLOG_SAVE_REG_PAIR fp, lr, #-224!
SAVE_ARGUMENT_REGISTERS sp, 16
SAVE_FLOAT_ARGUMENT_REGISTERS sp, 96
mov x0, x12
bl NDirectImportWorker
mov x12, x0
; pop the stack and restore original register state
RESTORE_FLOAT_ARGUMENT_REGISTERS sp, 96
RESTORE_ARGUMENT_REGISTERS sp, 16
EPILOG_RESTORE_REG_PAIR fp, lr, #224!
; If we got back from NDirectImportWorker, the MD has been successfully
; linked. Proceed to execute the original DLL call.
EPILOG_BRANCH_REG x12
NESTED_END
; ------------------------------------------------------------------
; The call in fixup precode initally points to this function.
; The pupose of this function is to load the MethodDesc and forward the call to prestub.
NESTED_ENTRY PrecodeFixupThunk
; x12 = FixupPrecode *
; On Exit
; x12 = MethodDesc*
; x13, x14 Trashed
; Inline computation done by FixupPrecode::GetMethodDesc()
ldrb w13, [x12, #Offset_PrecodeChunkIndex] ; m_PrecodeChunkIndex
ldrb w14, [x12, #Offset_MethodDescChunkIndex] ; m_MethodDescChunkIndex
add x12,x12,w13,uxtw #FixupPrecode_ALIGNMENT_SHIFT_1
add x13,x12,w13,uxtw #FixupPrecode_ALIGNMENT_SHIFT_2
ldr x13, [x13,#SIZEOF__FixupPrecode]
add x12,x13,w14,uxtw #MethodDesc_ALIGNMENT_SHIFT
b ThePreStub
NESTED_END
; ------------------------------------------------------------------
NESTED_ENTRY ThePreStub
PROLOG_WITH_TRANSITION_BLOCK
add x0, sp, #__PWTB_TransitionBlock ; pTransitionBlock
mov x1, METHODDESC_REGISTER ; pMethodDesc
bl PreStubWorker
mov x9, x0
EPILOG_WITH_TRANSITION_BLOCK_TAILCALL
EPILOG_BRANCH_REG x9
NESTED_END
;; ------------------------------------------------------------------
;; ThePreStubPatch()
LEAF_ENTRY ThePreStubPatch
nop
ThePreStubPatchLabel
EXPORT ThePreStubPatchLabel
ret lr
LEAF_END
;-----------------------------------------------------------------------------
; The following Macros help in WRITE_BARRIER Implemetations
; WRITE_BARRIER_ENTRY
;
; Declare the start of a write barrier function. Use similarly to NESTED_ENTRY. This is the only legal way
; to declare a write barrier function.
;
MACRO
WRITE_BARRIER_ENTRY $name
LEAF_ENTRY $name
MEND
; WRITE_BARRIER_END
;
; The partner to WRITE_BARRIER_ENTRY, used like NESTED_END.
;
MACRO
WRITE_BARRIER_END $__write_barrier_name
LEAF_END_MARKED $__write_barrier_name
MEND
; ------------------------------------------------------------------
; Start of the writeable code region
LEAF_ENTRY JIT_PatchedCodeStart
ret lr
LEAF_END
;-----------------------------------------------------------------------------
; void JIT_UpdateWriteBarrierState(bool skipEphemeralCheck)
;
; Update shadow copies of the various state info required for barrier
;
; State info is contained in a literal pool at the end of the function
; Placed in text section so that it is close enough to use ldr literal and still
; be relocatable. Eliminates need for PREPARE_EXTERNAL_VAR in hot code.
;
; Align and group state info together so it fits in a single cache line
; and each entry can be written atomically
;
WRITE_BARRIER_ENTRY JIT_UpdateWriteBarrierState
PROLOG_SAVE_REG_PAIR fp, lr, #-16!
; x0-x7 will contain intended new state
; x8 will preserve skipEphemeralCheck
; x12 will be used for pointers
mov x8, x0
adrp x12, g_card_table
ldr x0, [x12, g_card_table]
#ifdef FEATURE_MANUALLY_MANAGED_CARD_BUNDLES
adrp x12, g_card_bundle_table
ldr x1, [x12, g_card_bundle_table]
#endif
#ifdef WRITE_BARRIER_CHECK
adrp x12, $g_GCShadow
ldr x2, [x12, $g_GCShadow]
#endif
#ifdef FEATURE_USE_SOFTWARE_WRITE_WATCH_FOR_GC_HEAP
adrp x12, g_sw_ww_table
ldr x3, [x12, g_sw_ww_table]
#endif
adrp x12, g_ephemeral_low
ldr x4, [x12, g_ephemeral_low]
adrp x12, g_ephemeral_high
ldr x5, [x12, g_ephemeral_high]
; Check skipEphemeralCheck
cbz x8, EphemeralCheckEnabled
movz x4, #0
movn x5, #0
EphemeralCheckEnabled
adrp x12, g_lowest_address
ldr x6, [x12, g_lowest_address]
adrp x12, g_highest_address
ldr x7, [x12, g_highest_address]
; Update wbs state
adr x12, wbs_begin
stp x0, x1, [x12], 16
stp x2, x3, [x12], 16
stp x4, x5, [x12], 16
stp x6, x7, [x12], 16
EPILOG_RESTORE_REG_PAIR fp, lr, #16!
EPILOG_RETURN
; Begin patchable literal pool
ALIGN 64 ; Align to power of two at least as big as patchable literal pool so that it fits optimally in cache line
wbs_begin
wbs_card_table
DCQ 0
wbs_card_bundle_table
DCQ 0
wbs_GCShadow
DCQ 0
wbs_sw_ww_table
DCQ 0
wbs_ephemeral_low
DCQ 0
wbs_ephemeral_high
DCQ 0
wbs_lowest_address
DCQ 0
wbs_highest_address
DCQ 0
WRITE_BARRIER_END JIT_UpdateWriteBarrierState
; ------------------------------------------------------------------
; End of the writeable code region
LEAF_ENTRY JIT_PatchedCodeLast
ret lr
LEAF_END
; void JIT_ByRefWriteBarrier
; On entry:
; x13 : the source address (points to object reference to write)
; x14 : the destination address (object reference written here)
;
; On exit:
; x12 : trashed
; x13 : incremented by 8
; x14 : incremented by 8
; x15 : trashed
; x17 : trashed (ip1) if FEATURE_USE_SOFTWARE_WRITE_WATCH_FOR_GC_HEAP
;
WRITE_BARRIER_ENTRY JIT_ByRefWriteBarrier
ldr x15, [x13], 8
b JIT_CheckedWriteBarrier
WRITE_BARRIER_END JIT_ByRefWriteBarrier
;-----------------------------------------------------------------------------
; Simple WriteBarriers
; void JIT_CheckedWriteBarrier(Object** dst, Object* src)
; On entry:
; x14 : the destination address (LHS of the assignment)
; x15 : the object reference (RHS of the assignment)
;
; On exit:
; x12 : trashed
; x14 : incremented by 8
; x15 : trashed
; x17 : trashed (ip1) if FEATURE_USE_SOFTWARE_WRITE_WATCH_FOR_GC_HEAP
;
WRITE_BARRIER_ENTRY JIT_CheckedWriteBarrier
ldr x12, wbs_lowest_address
cmp x14, x12
ldr x12, wbs_highest_address
ccmphs x14, x12, #0x2
blo JIT_WriteBarrier
NotInHeap
str x15, [x14], 8
ret lr
WRITE_BARRIER_END JIT_CheckedWriteBarrier
; void JIT_WriteBarrier(Object** dst, Object* src)
; On entry:
; x14 : the destination address (LHS of the assignment)
; x15 : the object reference (RHS of the assignment)
;
; On exit:
; x12 : trashed
; x14 : incremented by 8
; x15 : trashed
; x17 : trashed (ip1) if FEATURE_USE_SOFTWARE_WRITE_WATCH_FOR_GC_HEAP
;
WRITE_BARRIER_ENTRY JIT_WriteBarrier
stlr x15, [x14]
#ifdef WRITE_BARRIER_CHECK
; Update GC Shadow Heap
; Do not perform the work if g_GCShadow is 0
ldr x12, wbs_GCShadow
cbz x12, ShadowUpdateDisabled
; need temporary register. Save before using.
str x13, [sp, #-16]!
; Compute address of shadow heap location:
; pShadow = $g_GCShadow + (x14 - g_lowest_address)
ldr x13, wbs_lowest_address
sub x13, x14, x13
add x12, x13, x12
; if (pShadow >= $g_GCShadowEnd) goto end
adrp x13, $g_GCShadowEnd
ldr x13, [x13, $g_GCShadowEnd]
cmp x12, x13
bhs ShadowUpdateEnd
; *pShadow = x15
str x15, [x12]
; Ensure that the write to the shadow heap occurs before the read from the GC heap so that race
; conditions are caught by INVALIDGCVALUE.
dmb ish
; if ([x14] == x15) goto end
ldr x13, [x14]
cmp x13, x15
beq ShadowUpdateEnd
; *pShadow = INVALIDGCVALUE (0xcccccccd)
movz x13, #0xcccd
movk x13, #0xcccc, LSL #16
str x13, [x12]
ShadowUpdateEnd
ldr x13, [sp], #16
ShadowUpdateDisabled
#endif
#ifdef FEATURE_USE_SOFTWARE_WRITE_WATCH_FOR_GC_HEAP
; Update the write watch table if necessary
ldr x12, wbs_sw_ww_table
cbz x12, CheckCardTable
add x12, x12, x14, LSR #0xC // SoftwareWriteWatch::AddressToTableByteIndexShift
ldrb w17, [x12]
cbnz x17, CheckCardTable
mov w17, 0xFF
strb w17, [x12]
#endif
CheckCardTable
; Branch to Exit if the reference is not in the Gen0 heap
;
adr x12, wbs_ephemeral_low
ldp x12, x16, [x12]
cbz x12, SkipEphemeralCheck
cmp x15, x12
blo Exit
cmp x15, x16
bhi Exit
SkipEphemeralCheck
; Check if we need to update the card table
ldr x12, wbs_card_table
; x15 := pointer into card table
add x15, x12, x14, lsr #11
ldrb w12, [x15]
cmp x12, 0xFF
beq Exit
UpdateCardTable
mov x12, 0xFF
strb w12, [x15]
#ifdef FEATURE_MANUALLY_MANAGED_CARD_BUNDLES
; Check if we need to update the card bundle table
ldr x12, wbs_card_bundle_table
; x15 := pointer into card bundle table
add x15, x12, x14, lsr #21
ldrb w12, [x15]
cmp x12, 0xFF
beq Exit
mov x12, 0xFF
strb w12, [x15]
#endif
Exit
add x14, x14, 8
ret lr
WRITE_BARRIER_END JIT_WriteBarrier
#ifdef FEATURE_PREJIT
;------------------------------------------------
; VirtualMethodFixupStub
;
; In NGEN images, virtual slots inherited from cross-module dependencies
; point to a jump thunk that calls into the following function that will
; call into a VM helper. The VM helper is responsible for patching up
; thunk, upon executing the precode, so that all subsequent calls go directly
; to the actual method body.
;
; This is done lazily for performance reasons.
;
; On entry:
;
; x0 = "this" pointer
; x12 = Address of thunk
NESTED_ENTRY VirtualMethodFixupStub
; Save arguments and return address
PROLOG_SAVE_REG_PAIR fp, lr, #-224!
SAVE_ARGUMENT_REGISTERS sp, 16
SAVE_FLOAT_ARGUMENT_REGISTERS sp, 96
; Refer to ZapImportVirtualThunk::Save
; for details on this.
;
; Move the thunk start address in x1
mov x1, x12
; Call the helper in the VM to perform the actual fixup
; and tell us where to tail call. x0 already contains
; the this pointer.
bl VirtualMethodFixupWorker
; On return, x0 contains the target to tailcall to
mov x12, x0
; pop the stack and restore original register state
RESTORE_ARGUMENT_REGISTERS sp, 16
RESTORE_FLOAT_ARGUMENT_REGISTERS sp, 96
EPILOG_RESTORE_REG_PAIR fp, lr, #224!
PATCH_LABEL VirtualMethodFixupPatchLabel
; and tailcall to the actual method
EPILOG_BRANCH_REG x12
NESTED_END
#endif // FEATURE_PREJIT
;------------------------------------------------
; ExternalMethodFixupStub
;
; In NGEN images, calls to cross-module external methods initially
; point to a jump thunk that calls into the following function that will
; call into a VM helper. The VM helper is responsible for patching up the
; thunk, upon executing the precode, so that all subsequent calls go directly
; to the actual method body.
;
; This is done lazily for performance reasons.
;
; On entry:
;
; x12 = Address of thunk
NESTED_ENTRY ExternalMethodFixupStub
PROLOG_WITH_TRANSITION_BLOCK
add x0, sp, #__PWTB_TransitionBlock ; pTransitionBlock
mov x1, x12 ; pThunk
bl ExternalMethodFixupWorker
; mov the address we patched to in x12 so that we can tail call to it
mov x12, x0
EPILOG_WITH_TRANSITION_BLOCK_TAILCALL
PATCH_LABEL ExternalMethodFixupPatchLabel
EPILOG_BRANCH_REG x12
NESTED_END
; void SinglecastDelegateInvokeStub(Delegate *pThis)
LEAF_ENTRY SinglecastDelegateInvokeStub
cmp x0, #0
beq LNullThis
ldr x16, [x0, #DelegateObject___methodPtr]
ldr x0, [x0, #DelegateObject___target]
br x16
LNullThis
mov x0, #CORINFO_NullReferenceException_ASM
b JIT_InternalThrow
LEAF_END
#ifdef FEATURE_COMINTEROP
; ------------------------------------------------------------------
; setStubReturnValue
; w0 - size of floating point return value (MetaSig::GetFPReturnSize())
; x1 - pointer to the return buffer in the stub frame
LEAF_ENTRY setStubReturnValue
cbz w0, NoFloatingPointRetVal
;; Float return case
cmp x0, #4
bne LNoFloatRetVal
ldr s0, [x1]
ret
LNoFloatRetVal
;; Double return case
cmp w0, #8
bne LNoDoubleRetVal
ldr d0, [x1]
ret
LNoDoubleRetVal
;; Float HFA return case
cmp w0, #16
bne LNoFloatHFARetVal
ldp s0, s1, [x1]
ldp s2, s3, [x1, #8]
ret
LNoFloatHFARetVal
;;Double HFA return case
cmp w0, #32
bne LNoDoubleHFARetVal
ldp d0, d1, [x1]
ldp d2, d3, [x1, #16]
ret
LNoDoubleHFARetVal
;;Vector HVA return case
cmp w3, #64
bne LNoVectorHVARetVal
ldp q0, q1, [x1]
ldp q2, q3, [x1, #32]
ret
LNoVectorHVARetVal
EMIT_BREAKPOINT ; Unreachable
NoFloatingPointRetVal
;; Restore the return value from retbuf
ldr x0, [x1]
ldr x1, [x1, #8]
ret
LEAF_END
; ------------------------------------------------------------------
; GenericComPlusCallStub that erects a ComPlusMethodFrame and calls into the runtime
; (CLRToCOMWorker) to dispatch rare cases of the interface call.
;
; On entry:
; x0 : 'this' object
; x12 : Interface MethodDesc*
; plus user arguments in registers and on the stack
;
; On exit:
; x0/x1/s0-s3/d0-d3 set to return value of the call as appropriate
;
NESTED_ENTRY GenericComPlusCallStub
PROLOG_WITH_TRANSITION_BLOCK ASM_ENREGISTERED_RETURNTYPE_MAXSIZE
add x0, sp, #__PWTB_TransitionBlock ; pTransitionBlock
mov x1, x12 ; pMethodDesc
; Call CLRToCOMWorker(TransitionBlock *, ComPlusCallMethodDesc *).
; This call will set up the rest of the frame (including the vfptr, the GS cookie and
; linking to the thread), make the client call and return with correct registers set
; (x0/x1/s0-s3/d0-d3 as appropriate).
bl CLRToCOMWorker
; x0 = fpRetSize
; The return value is stored before float argument registers
add x1, sp, #(__PWTB_FloatArgumentRegisters - ASM_ENREGISTERED_RETURNTYPE_MAXSIZE)
bl setStubReturnValue
EPILOG_WITH_TRANSITION_BLOCK_RETURN
NESTED_END
; ------------------------------------------------------------------
; COM to CLR stub called the first time a particular method is invoked.
;
; On entry:
; x12 : ComCallMethodDesc* provided by prepad thunk
; plus user arguments in registers and on the stack
;
; On exit:
; tail calls to real method
;
NESTED_ENTRY ComCallPreStub
GBLA ComCallPreStub_FrameSize
GBLA ComCallPreStub_StackAlloc
GBLA ComCallPreStub_FrameOffset
GBLA ComCallPreStub_ErrorReturnOffset
GBLA ComCallPreStub_FirstStackAdjust
ComCallPreStub_FrameSize SETA (SIZEOF__GSCookie + SIZEOF__ComMethodFrame)
ComCallPreStub_FirstStackAdjust SETA (8 + SIZEOF__ArgumentRegisters + 2 * 8) ; x8, reg args , fp & lr already pushed
ComCallPreStub_StackAlloc SETA ComCallPreStub_FrameSize - ComCallPreStub_FirstStackAdjust
ComCallPreStub_StackAlloc SETA ComCallPreStub_StackAlloc + SIZEOF__FloatArgumentRegisters + 8; 8 for ErrorReturn
IF ComCallPreStub_StackAlloc:MOD:16 != 0
ComCallPreStub_StackAlloc SETA ComCallPreStub_StackAlloc + 8
ENDIF
ComCallPreStub_FrameOffset SETA (ComCallPreStub_StackAlloc - (SIZEOF__ComMethodFrame - ComCallPreStub_FirstStackAdjust))
ComCallPreStub_ErrorReturnOffset SETA SIZEOF__FloatArgumentRegisters
IF (ComCallPreStub_FirstStackAdjust):MOD:16 != 0
ComCallPreStub_FirstStackAdjust SETA ComCallPreStub_FirstStackAdjust + 8
ENDIF
; Save arguments and return address
PROLOG_SAVE_REG_PAIR fp, lr, #-ComCallPreStub_FirstStackAdjust!
PROLOG_STACK_ALLOC ComCallPreStub_StackAlloc
SAVE_ARGUMENT_REGISTERS sp, (16+ComCallPreStub_StackAlloc)
SAVE_FLOAT_ARGUMENT_REGISTERS sp, 0
str x12, [sp, #(ComCallPreStub_FrameOffset + UnmanagedToManagedFrame__m_pvDatum)]
add x0, sp, #(ComCallPreStub_FrameOffset)
add x1, sp, #(ComCallPreStub_ErrorReturnOffset)
bl ComPreStubWorker
cbz x0, ComCallPreStub_ErrorExit
mov x12, x0
; pop the stack and restore original register state
RESTORE_FLOAT_ARGUMENT_REGISTERS sp, 0
RESTORE_ARGUMENT_REGISTERS sp, (16+ComCallPreStub_StackAlloc)
EPILOG_STACK_FREE ComCallPreStub_StackAlloc
EPILOG_RESTORE_REG_PAIR fp, lr, #ComCallPreStub_FirstStackAdjust!
; and tailcall to the actual method
EPILOG_BRANCH_REG x12
ComCallPreStub_ErrorExit
ldr x0, [sp, #(ComCallPreStub_ErrorReturnOffset)] ; ErrorReturn
; pop the stack
EPILOG_STACK_FREE ComCallPreStub_StackAlloc
EPILOG_RESTORE_REG_PAIR fp, lr, #ComCallPreStub_FirstStackAdjust!
EPILOG_RETURN
NESTED_END
; ------------------------------------------------------------------
; COM to CLR stub which sets up a ComMethodFrame and calls COMToCLRWorker.
;
; On entry:
; x12 : ComCallMethodDesc* provided by prepad thunk
; plus user arguments in registers and on the stack
;
; On exit:
; Result in x0/d0 as per the real method being called
;
NESTED_ENTRY GenericComCallStub
GBLA GenericComCallStub_FrameSize
GBLA GenericComCallStub_StackAlloc
GBLA GenericComCallStub_FrameOffset
GBLA GenericComCallStub_FirstStackAdjust
GenericComCallStub_FrameSize SETA (SIZEOF__GSCookie + SIZEOF__ComMethodFrame)
GenericComCallStub_FirstStackAdjust SETA (8 + SIZEOF__ArgumentRegisters + 2 * 8)
GenericComCallStub_StackAlloc SETA GenericComCallStub_FrameSize - GenericComCallStub_FirstStackAdjust
GenericComCallStub_StackAlloc SETA GenericComCallStub_StackAlloc + SIZEOF__FloatArgumentRegisters
IF (GenericComCallStub_StackAlloc):MOD:16 != 0
GenericComCallStub_StackAlloc SETA GenericComCallStub_StackAlloc + 8
ENDIF
GenericComCallStub_FrameOffset SETA (GenericComCallStub_StackAlloc - (SIZEOF__ComMethodFrame - GenericComCallStub_FirstStackAdjust))
IF (GenericComCallStub_FirstStackAdjust):MOD:16 != 0
GenericComCallStub_FirstStackAdjust SETA GenericComCallStub_FirstStackAdjust + 8
ENDIF
; Save arguments and return address
PROLOG_SAVE_REG_PAIR fp, lr, #-GenericComCallStub_FirstStackAdjust!
PROLOG_STACK_ALLOC GenericComCallStub_StackAlloc
SAVE_ARGUMENT_REGISTERS sp, (16+GenericComCallStub_StackAlloc)
SAVE_FLOAT_ARGUMENT_REGISTERS sp, 0
str x12, [sp, #(GenericComCallStub_FrameOffset + UnmanagedToManagedFrame__m_pvDatum)]
add x1, sp, #GenericComCallStub_FrameOffset
bl COMToCLRWorker
; pop the stack
EPILOG_STACK_FREE GenericComCallStub_StackAlloc
EPILOG_RESTORE_REG_PAIR fp, lr, #GenericComCallStub_FirstStackAdjust!
EPILOG_RETURN
NESTED_END
; ------------------------------------------------------------------
; COM to CLR stub called from COMToCLRWorker that actually dispatches to the real managed method.
;
; On entry:
; x0 : dwStackSlots, count of argument stack slots to copy
; x1 : pFrame, ComMethodFrame pushed by GenericComCallStub above
; x2 : pTarget, address of code to call
; x3 : pSecretArg, hidden argument passed to target above in x12
; x4 : pDangerousThis, managed 'this' reference
;
; On exit:
; Result in x0/d0 as per the real method being called
;
NESTED_ENTRY COMToCLRDispatchHelper,,CallDescrWorkerUnwindFrameChainHandler
PROLOG_SAVE_REG_PAIR fp, lr, #-16!
cbz x0, COMToCLRDispatchHelper_RegSetup
add x9, x1, #SIZEOF__ComMethodFrame
; Compute number of 8 bytes slots to copy. This is done by rounding up the
; dwStackSlots value to the nearest even value
add x0, x0, #1
bic x0, x0, #1
; Compute how many slots to adjust the address to copy from. Since we
; are copying 16 bytes at a time, adjust by -1 from the rounded value
sub x6, x0, #1
add x9, x9, x6, LSL #3
COMToCLRDispatchHelper_StackLoop
ldp x7, x8, [x9], #-16 ; post-index
stp x7, x8, [sp, #-16]! ; pre-index
subs x0, x0, #2
bne COMToCLRDispatchHelper_StackLoop
COMToCLRDispatchHelper_RegSetup
; We need an aligned offset for restoring float args, so do the subtraction into
; a scratch register
sub x5, x1, GenericComCallStub_FrameOffset
RESTORE_FLOAT_ARGUMENT_REGISTERS x5, 0
mov lr, x2
mov x12, x3
mov x0, x4
ldp x2, x3, [x1, #(SIZEOF__ComMethodFrame - SIZEOF__ArgumentRegisters + 16)]
ldp x4, x5, [x1, #(SIZEOF__ComMethodFrame - SIZEOF__ArgumentRegisters + 32)]
ldp x6, x7, [x1, #(SIZEOF__ComMethodFrame - SIZEOF__ArgumentRegisters + 48)]
ldr x8, [x1, #(SIZEOF__ComMethodFrame - SIZEOF__ArgumentRegisters - 8)]
ldr x1, [x1, #(SIZEOF__ComMethodFrame - SIZEOF__ArgumentRegisters + 8)]
blr lr
EPILOG_STACK_RESTORE
EPILOG_RESTORE_REG_PAIR fp, lr, #16!
EPILOG_RETURN
NESTED_END
#endif ; FEATURE_COMINTEROP
;
; x12 = UMEntryThunk*
;
NESTED_ENTRY TheUMEntryPrestub,,UMEntryPrestubUnwindFrameChainHandler
; Save arguments and return address
PROLOG_SAVE_REG_PAIR fp, lr, #-224!
SAVE_ARGUMENT_REGISTERS sp, 16
SAVE_FLOAT_ARGUMENT_REGISTERS sp, 96
mov x0, x12
bl TheUMEntryPrestubWorker
; save real target address in x12.
mov x12, x0
; pop the stack and restore original register state
RESTORE_ARGUMENT_REGISTERS sp, 16
RESTORE_FLOAT_ARGUMENT_REGISTERS sp, 96
EPILOG_RESTORE_REG_PAIR fp, lr, #224!
; and tailcall to the actual method
EPILOG_BRANCH_REG x12
NESTED_END
;
; x12 = UMEntryThunk*
;
NESTED_ENTRY UMThunkStub,,UMThunkStubUnwindFrameChainHandler
; Save arguments and return address
PROLOG_SAVE_REG_PAIR fp, lr, #-112! ; 72 for regArgs, 8 for x19 & 8 for x12 & 8 for 16-byte align
; save callee saved reg x19. x19 is used in the method to store thread*
PROLOG_SAVE_REG x19, #96
SAVE_ARGUMENT_REGISTERS sp, 16
GBLA UMThunkStub_HiddenArg ; offset of saved UMEntryThunk *
GBLA UMThunkStub_StackArgs ; offset of original stack args (total size of UMThunkStub frame)
UMThunkStub_HiddenArg SETA 88
UMThunkStub_StackArgs SETA 112
; save UMEntryThunk*
str x12, [sp, #UMThunkStub_HiddenArg]
; x0 = GetThread(). Trashes x19
INLINE_GETTHREAD x0, x19
cbz x0, UMThunkStub_DoThreadSetup
UMThunkStub_HaveThread
mov x19, x0 ; x19 = Thread *
mov x9, 1
; m_fPreemptiveGCDisabled is 4 byte field so using 32-bit variant
str w9, [x19, #Thread__m_fPreemptiveGCDisabled]
ldr x2, =g_TrapReturningThreads
ldr x3, [x2]
; assuming x0 contains Thread* before jumping to UMThunkStub_DoTrapReturningThreads
cbnz x3, UMThunkStub_DoTrapReturningThreads
UMThunkStub_InCooperativeMode
ldr x12, [fp, #UMThunkStub_HiddenArg] ; x12 = UMEntryThunk*
ldr x3, [x12, #UMEntryThunk__m_pUMThunkMarshInfo] ; x3 = m_pUMThunkMarshInfo
; m_cbActualArgSize is UINT32 and hence occupies 4 bytes
ldr w2, [x3, #UMThunkMarshInfo__m_cbActualArgSize] ; w2 = Stack arg bytes
cbz w2, UMThunkStub_RegArgumentsSetup
; extend to 64-bits
uxtw x2, w2
; Source pointer
add x0, fp, #UMThunkStub_StackArgs
; move source pointer to end of Stack Args
add x0, x0, x2
; Count of stack slot pairs to copy (divide by 16)
lsr x1, x2, #4
; Is there an extra stack slot (can happen when stack arg bytes not multiple of 16)
and x2, x2, #8
; If yes then start source pointer from 16 byte aligned stack slot
add x0, x0, x2
; increment stack slot pair count by 1 if x2 is not zero
add x1, x1, x2, LSR #3
UMThunkStub_StackLoop
ldp x4, x5, [x0, #-16]! ; pre-Index
stp x4, x5, [sp, #-16]! ; pre-Index
subs x1, x1, #1
bne UMThunkStub_StackLoop
UMThunkStub_RegArgumentsSetup
ldr x16, [x3, #UMThunkMarshInfo__m_pILStub]
RESTORE_ARGUMENT_REGISTERS fp, 16
blr x16
UMThunkStub_PostCall
mov x4, 0
; m_fPreemptiveGCDisabled is 4 byte field so using 32-bit variant
str w4, [x19, #Thread__m_fPreemptiveGCDisabled]
EPILOG_STACK_RESTORE
EPILOG_RESTORE_REG x19, #96
EPILOG_RESTORE_REG_PAIR fp, lr, #112!
EPILOG_RETURN
UMThunkStub_DoThreadSetup
sub sp, sp, #SIZEOF__FloatArgumentRegisters
SAVE_FLOAT_ARGUMENT_REGISTERS sp, 0
bl CreateThreadBlockThrow
RESTORE_FLOAT_ARGUMENT_REGISTERS sp, 0
add sp, sp, #SIZEOF__FloatArgumentRegisters
b UMThunkStub_HaveThread
UMThunkStub_DoTrapReturningThreads
sub sp, sp, #SIZEOF__FloatArgumentRegisters
SAVE_FLOAT_ARGUMENT_REGISTERS sp, 0
; x0 already contains Thread* pThread
; UMEntryThunk* pUMEntry
ldr x1, [fp, #UMThunkStub_HiddenArg]
bl UMThunkStubRareDisableWorker
RESTORE_FLOAT_ARGUMENT_REGISTERS sp, 0
add sp, sp, #SIZEOF__FloatArgumentRegisters
b UMThunkStub_InCooperativeMode
NESTED_END
INLINE_GETTHREAD_CONSTANT_POOL
#ifdef FEATURE_HIJACK
; ------------------------------------------------------------------
; Hijack function for functions which return a scalar type or a struct (value type)
NESTED_ENTRY OnHijackTripThread
PROLOG_SAVE_REG_PAIR fp, lr, #-176!
; Spill callee saved registers
PROLOG_SAVE_REG_PAIR x19, x20, #16
PROLOG_SAVE_REG_PAIR x21, x22, #32
PROLOG_SAVE_REG_PAIR x23, x24, #48
PROLOG_SAVE_REG_PAIR x25, x26, #64
PROLOG_SAVE_REG_PAIR x27, x28, #80
; save any integral return value(s)
stp x0, x1, [sp, #96]
; save any FP/HFA/HVA return value(s)
stp q0, q1, [sp, #112]
stp q2, q3, [sp, #144]
mov x0, sp
bl OnHijackWorker
; restore any integral return value(s)
ldp x0, x1, [sp, #96]
; restore any FP/HFA/HVA return value(s)
ldp q0, q1, [sp, #112]
ldp q2, q3, [sp, #144]
EPILOG_RESTORE_REG_PAIR x19, x20, #16
EPILOG_RESTORE_REG_PAIR x21, x22, #32
EPILOG_RESTORE_REG_PAIR x23, x24, #48
EPILOG_RESTORE_REG_PAIR x25, x26, #64
EPILOG_RESTORE_REG_PAIR x27, x28, #80
EPILOG_RESTORE_REG_PAIR fp, lr, #176!
EPILOG_RETURN
NESTED_END
#endif ; FEATURE_HIJACK
;; ------------------------------------------------------------------
;; Redirection Stub for GC in fully interruptible method
GenerateRedirectedHandledJITCaseStub GCThreadControl
;; ------------------------------------------------------------------
GenerateRedirectedHandledJITCaseStub DbgThreadControl
;; ------------------------------------------------------------------
GenerateRedirectedHandledJITCaseStub UserSuspend
#ifdef _DEBUG
; ------------------------------------------------------------------
; Redirection Stub for GC Stress
GenerateRedirectedHandledJITCaseStub GCStress
#endif
; ------------------------------------------------------------------
; This helper enables us to call into a funclet after restoring Fp register
NESTED_ENTRY CallEHFunclet
; On entry:
;
; X0 = throwable
; X1 = PC to invoke
; X2 = address of X19 register in CONTEXT record; used to restore the non-volatile registers of CrawlFrame
; X3 = address of the location where the SP of funclet's caller (i.e. this helper) should be saved.
;
; Using below prolog instead of PROLOG_SAVE_REG_PAIR fp,lr, #-16!
; is intentional. Above statement would also emit instruction to save
; sp in fp. If sp is saved in fp in prolog then it is not expected that fp can change in the body
; of method. However, this method needs to be able to change fp before calling funclet.
; This is required to access locals in funclet.
PROLOG_SAVE_REG_PAIR_NO_FP fp,lr, #-96!
; Spill callee saved registers
PROLOG_SAVE_REG_PAIR x19, x20, 16
PROLOG_SAVE_REG_PAIR x21, x22, 32
PROLOG_SAVE_REG_PAIR x23, x24, 48
PROLOG_SAVE_REG_PAIR x25, x26, 64
PROLOG_SAVE_REG_PAIR x27, x28, 80
; Save the SP of this function. We cannot store SP directly.
mov fp, sp
str fp, [x3]
ldp x19, x20, [x2, #0]
ldp x21, x22, [x2, #16]
ldp x23, x24, [x2, #32]
ldp x25, x26, [x2, #48]
ldp x27, x28, [x2, #64]
ldr fp, [x2, #80] ; offset of fp in CONTEXT relative to X19
; Invoke the funclet
blr x1
nop
EPILOG_RESTORE_REG_PAIR x19, x20, 16
EPILOG_RESTORE_REG_PAIR x21, x22, 32
EPILOG_RESTORE_REG_PAIR x23, x24, 48
EPILOG_RESTORE_REG_PAIR x25, x26, 64
EPILOG_RESTORE_REG_PAIR x27, x28, 80
EPILOG_RESTORE_REG_PAIR fp, lr, #96!
EPILOG_RETURN
NESTED_END CallEHFunclet
; This helper enables us to call into a filter funclet by passing it the CallerSP to lookup the
; frame pointer for accessing the locals in the parent method.
NESTED_ENTRY CallEHFilterFunclet
PROLOG_SAVE_REG_PAIR fp, lr, #-16!
; On entry:
;
; X0 = throwable
; X1 = SP of the caller of the method/funclet containing the filter
; X2 = PC to invoke
; X3 = address of the location where the SP of funclet's caller (i.e. this helper) should be saved.
;
; Save the SP of this function
str fp, [x3]
; Invoke the filter funclet
blr x2
EPILOG_RESTORE_REG_PAIR fp, lr, #16!
EPILOG_RETURN
NESTED_END CallEHFilterFunclet
GBLA FaultingExceptionFrame_StackAlloc
GBLA FaultingExceptionFrame_FrameOffset
FaultingExceptionFrame_StackAlloc SETA (SIZEOF__GSCookie + SIZEOF__FaultingExceptionFrame)
FaultingExceptionFrame_FrameOffset SETA SIZEOF__GSCookie
MACRO
GenerateRedirectedStubWithFrame $STUB, $TARGET
;
; This is the primary function to which execution will be redirected to.
;
NESTED_ENTRY $STUB
;
; IN: lr: original IP before redirect
;
PROLOG_SAVE_REG_PAIR fp, lr, #-16!
PROLOG_STACK_ALLOC FaultingExceptionFrame_StackAlloc
; At this point, the stack maybe misaligned if the thread abort was asynchronously
; triggered in the prolog or epilog of the managed method. For such a case, we must
; align the stack before calling into the VM.
;
; Runtime check for 16-byte alignment.
mov x0, sp
and x0, x0, #15
sub sp, sp, x0
; Save pointer to FEF for GetFrameFromRedirectedStubStackFrame
add x19, sp, #FaultingExceptionFrame_FrameOffset
; Prepare to initialize to NULL
mov x1,#0
str x1, [x19] ; Initialize vtbl (it is not strictly necessary)
str x1, [x19, #FaultingExceptionFrame__m_fFilterExecuted] ; Initialize BOOL for personality routine
mov x0, x19 ; move the ptr to FEF in X0
bl $TARGET
; Target should not return.
EMIT_BREAKPOINT
NESTED_END $STUB
MEND
; ------------------------------------------------------------------
;
; Helpers for async (NullRef, AccessViolation) exceptions
;
NESTED_ENTRY NakedThrowHelper2,,FixContextHandler
PROLOG_SAVE_REG_PAIR fp,lr, #-16!
; On entry:
;
; X0 = Address of FaultingExceptionFrame
bl LinkFrameAndThrow
; Target should not return.
EMIT_BREAKPOINT
NESTED_END NakedThrowHelper2
GenerateRedirectedStubWithFrame NakedThrowHelper, NakedThrowHelper2
; ------------------------------------------------------------------
; ResolveWorkerChainLookupAsmStub
;
; This method will perform a quick chained lookup of the entry if the
; initial cache lookup fails.
;
; On Entry:
; x9 contains the pointer to the current ResolveCacheElem
; x11 contains the address of the indirection (and the flags in the low two bits)
; x12 contains our contract the DispatchToken
; Must be preserved:
; x0 contains the instance object ref that we are making an interface call on
; x9 Must point to a ResolveCacheElem [For Sanity]
; [x1-x7] contains any additional register arguments for the interface method
;
; Loaded from x0
; x13 contains our type the MethodTable (from object ref in x0)
;
; On Exit:
; x0, [x1-x7] arguments for the interface implementation target
;
; On Exit (to ResolveWorkerAsmStub):
; x11 contains the address of the indirection and the flags in the low two bits.
; x12 contains our contract (DispatchToken)
; x16,x17 will be trashed
;
GBLA BACKPATCH_FLAG ; two low bit flags used by ResolveWorkerAsmStub
GBLA PROMOTE_CHAIN_FLAG ; two low bit flags used by ResolveWorkerAsmStub
BACKPATCH_FLAG SETA 1
PROMOTE_CHAIN_FLAG SETA 2
NESTED_ENTRY ResolveWorkerChainLookupAsmStub
tst x11, #BACKPATCH_FLAG ; First we check if x11 has the BACKPATCH_FLAG set
bne Fail ; If the BACKPATCH_FLAGS is set we will go directly to the ResolveWorkerAsmStub
ldr x13, [x0] ; retrieve the MethodTable from the object ref in x0
MainLoop
ldr x9, [x9, #ResolveCacheElem__pNext] ; x9 <= the next entry in the chain
cmp x9, #0
beq Fail
ldp x16, x17, [x9]
cmp x16, x13 ; compare our MT with the one in the ResolveCacheElem
bne MainLoop
cmp x17, x12 ; compare our DispatchToken with one in the ResolveCacheElem
bne MainLoop
Success
ldr x13, =g_dispatch_cache_chain_success_counter
ldr x16, [x13]
subs x16, x16, #1
str x16, [x13]
blt Promote
ldr x16, [x9, #ResolveCacheElem__target] ; get the ImplTarget
br x16 ; branch to interface implemenation target
Promote
; Move this entry to head postion of the chain
mov x16, #256
str x16, [x13] ; be quick to reset the counter so we don't get a bunch of contending threads
orr x11, x11, #PROMOTE_CHAIN_FLAG ; set PROMOTE_CHAIN_FLAG
mov x12, x9 ; We pass the ResolveCacheElem to ResolveWorkerAsmStub instead of the DispatchToken
Fail
b ResolveWorkerAsmStub ; call the ResolveWorkerAsmStub method to transition into the VM
NESTED_END ResolveWorkerChainLookupAsmStub
;; ------------------------------------------------------------------
;; void ResolveWorkerAsmStub(args in regs x0-x7 & stack and possibly retbuf arg in x8, x11:IndirectionCellAndFlags, x12:DispatchToken)
;;
;; The stub dispatch thunk which transfers control to VSD_ResolveWorker.
NESTED_ENTRY ResolveWorkerAsmStub
PROLOG_WITH_TRANSITION_BLOCK
add x0, sp, #__PWTB_TransitionBlock ; pTransitionBlock
and x1, x11, #-4 ; Indirection cell
mov x2, x12 ; DispatchToken
and x3, x11, #3 ; flag
bl VSD_ResolveWorker
mov x9, x0
EPILOG_WITH_TRANSITION_BLOCK_TAILCALL
EPILOG_BRANCH_REG x9
NESTED_END
#ifdef FEATURE_READYTORUN
NESTED_ENTRY DelayLoad_MethodCall
PROLOG_WITH_TRANSITION_BLOCK
add x0, sp, #__PWTB_TransitionBlock ; pTransitionBlock
mov x1, x11 ; Indirection cell
mov x2, x9 ; sectionIndex
mov x3, x10 ; Module*
bl ExternalMethodFixupWorker
mov x12, x0
EPILOG_WITH_TRANSITION_BLOCK_TAILCALL
; Share patch label
b ExternalMethodFixupPatchLabel
NESTED_END
MACRO
DynamicHelper $frameFlags, $suffix
NESTED_ENTRY DelayLoad_Helper$suffix
PROLOG_WITH_TRANSITION_BLOCK
add x0, sp, #__PWTB_TransitionBlock ; pTransitionBlock
mov x1, x11 ; Indirection cell
mov x2, x9 ; sectionIndex
mov x3, x10 ; Module*
mov x4, $frameFlags
bl DynamicHelperWorker
cbnz x0, %FT0
ldr x0, [sp, #__PWTB_ArgumentRegister_FirstArg]
EPILOG_WITH_TRANSITION_BLOCK_RETURN
0
mov x12, x0
EPILOG_WITH_TRANSITION_BLOCK_TAILCALL
EPILOG_BRANCH_REG x12
NESTED_END
MEND
DynamicHelper DynamicHelperFrameFlags_Default
DynamicHelper DynamicHelperFrameFlags_ObjectArg, _Obj
DynamicHelper DynamicHelperFrameFlags_ObjectArg | DynamicHelperFrameFlags_ObjectArg2, _ObjObj
#endif // FEATURE_READYTORUN
#ifdef FEATURE_PREJIT
;; ------------------------------------------------------------------
;; void StubDispatchFixupStub(args in regs x0-x7 & stack and possibly retbuff arg in x8, x11:IndirectionCellAndFlags)
;;
;; The stub dispatch thunk which transfers control to StubDispatchFixupWorker.
NESTED_ENTRY StubDispatchFixupStub
PROLOG_WITH_TRANSITION_BLOCK
add x0, sp, #__PWTB_TransitionBlock ; pTransitionBlock
and x1, x11, #-4 ; Indirection cell
mov x2, #0 ; sectionIndex
mov x3, #0 ; pModule
bl StubDispatchFixupWorker
mov x12, x0
EPILOG_WITH_TRANSITION_BLOCK_TAILCALL
PATCH_LABEL StubDispatchFixupPatchLabel
EPILOG_BRANCH_REG x12
NESTED_END
#endif
#ifdef FEATURE_COMINTEROP
; ------------------------------------------------------------------
; Function used by COM interop to get floating point return value (since it's not in the same
; register(s) as non-floating point values).
;
; On entry;
; x0 : size of the FP result (4 or 8 bytes)
; x1 : pointer to 64-bit buffer to receive result
;
; On exit:
; buffer pointed to by x1 on entry contains the float or double argument as appropriate
;
LEAF_ENTRY getFPReturn
str d0, [x1]
LEAF_END
; ------------------------------------------------------------------
; Function used by COM interop to set floating point return value (since it's not in the same
; register(s) as non-floating point values).
;
; On entry:
; x0 : size of the FP result (4 or 8 bytes)
; x1 : 32-bit or 64-bit FP result
;
; On exit:
; s0 : float result if x0 == 4
; d0 : double result if x0 == 8
;
LEAF_ENTRY setFPReturn
fmov d0, x1
LEAF_END
#endif
;
; JIT Static access helpers when coreclr host specifies single appdomain flag
;
; ------------------------------------------------------------------
; void* JIT_GetSharedNonGCStaticBase(SIZE_T moduleDomainID, DWORD dwClassDomainID)
LEAF_ENTRY JIT_GetSharedNonGCStaticBase_SingleAppDomain
; If class is not initialized, bail to C++ helper
add x2, x0, #DomainLocalModule__m_pDataBlob
ldrb w2, [x2, w1]
tst w2, #1
beq CallHelper1
ret lr
CallHelper1
; Tail call JIT_GetSharedNonGCStaticBase_Helper
b JIT_GetSharedNonGCStaticBase_Helper
LEAF_END
; ------------------------------------------------------------------
; void* JIT_GetSharedNonGCStaticBaseNoCtor(SIZE_T moduleDomainID, DWORD dwClassDomainID)
LEAF_ENTRY JIT_GetSharedNonGCStaticBaseNoCtor_SingleAppDomain
ret lr
LEAF_END
; ------------------------------------------------------------------
; void* JIT_GetSharedGCStaticBase(SIZE_T moduleDomainID, DWORD dwClassDomainID)
LEAF_ENTRY JIT_GetSharedGCStaticBase_SingleAppDomain
; If class is not initialized, bail to C++ helper
add x2, x0, #DomainLocalModule__m_pDataBlob
ldrb w2, [x2, w1]
tst w2, #1
beq CallHelper2
ldr x0, [x0, #DomainLocalModule__m_pGCStatics]
ret lr
CallHelper2
; Tail call Jit_GetSharedGCStaticBase_Helper
b JIT_GetSharedGCStaticBase_Helper
LEAF_END
; ------------------------------------------------------------------
; void* JIT_GetSharedGCStaticBaseNoCtor(SIZE_T moduleDomainID, DWORD dwClassDomainID)
LEAF_ENTRY JIT_GetSharedGCStaticBaseNoCtor_SingleAppDomain
ldr x0, [x0, #DomainLocalModule__m_pGCStatics]
ret lr
LEAF_END
; ------------------------------------------------------------------
;__declspec(naked) void F_CALL_CONV JIT_Stelem_Ref(PtrArray* array, unsigned idx, Object* val)
LEAF_ENTRY JIT_Stelem_Ref
; We retain arguments as they were passed and use x0 == array x1 == idx x2 == val
; check for null array
cbz x0, ThrowNullReferenceException
; idx bounds check
ldr x3,[x0,#ArrayBase__m_NumComponents]
cmp x3, x1
bls ThrowIndexOutOfRangeException
; fast path to null assignment (doesn't need any write-barriers)
cbz x2, AssigningNull
; Verify the array-type and val-type matches before writing
ldr x12, [x0] ; x12 = array MT
ldr x3, [x2] ; x3 = val->GetMethodTable()
ldr x12, [x12, #MethodTable__m_ElementType] ; array->GetArrayElementTypeHandle()
cmp x3, x12
beq JIT_Stelem_DoWrite
; Types didnt match but allow writing into an array of objects
ldr x3, =$g_pObjectClass
ldr x3, [x3] ; x3 = *g_pObjectClass
cmp x3, x12 ; array type matches with Object*
beq JIT_Stelem_DoWrite
; array type and val type do not exactly match. Raise frame and do detailed match
b JIT_Stelem_Ref_NotExactMatch
AssigningNull
; Assigning null doesn't need write barrier
add x0, x0, x1, LSL #3 ; x0 = x0 + (x1 x 8) = array->m_array[idx]
str x2, [x0, #PtrArray__m_Array] ; array->m_array[idx] = val
ret
ThrowNullReferenceException
; Tail call JIT_InternalThrow(NullReferenceException)
ldr x0, =CORINFO_NullReferenceException_ASM
b JIT_InternalThrow
ThrowIndexOutOfRangeException
; Tail call JIT_InternalThrow(NullReferenceException)
ldr x0, =CORINFO_IndexOutOfRangeException_ASM
b JIT_InternalThrow
LEAF_END
; ------------------------------------------------------------------
; __declspec(naked) void F_CALL_CONV JIT_Stelem_Ref_NotExactMatch(PtrArray* array,
; unsigned idx, Object* val)
; x12 = array->GetArrayElementTypeHandle()
;
NESTED_ENTRY JIT_Stelem_Ref_NotExactMatch
PROLOG_SAVE_REG_PAIR fp, lr, #-48!
stp x0, x1, [sp, #16]
str x2, [sp, #32]
; allow in case val can be casted to array element type
; call ObjIsInstanceOfNoGC(val, array->GetArrayElementTypeHandle())
mov x1, x12 ; array->GetArrayElementTypeHandle()
mov x0, x2
bl ObjIsInstanceOfNoGC
cmp x0, TypeHandle_CanCast
beq DoWrite ; ObjIsInstance returned TypeHandle::CanCast
; check via raising frame
NeedFrame
add x1, sp, #16 ; x1 = &array
add x0, sp, #32 ; x0 = &val
bl ArrayStoreCheck ; ArrayStoreCheck(&val, &array)
DoWrite
ldp x0, x1, [sp, #16]
ldr x2, [sp, #32]
EPILOG_RESTORE_REG_PAIR fp, lr, #48!
EPILOG_BRANCH JIT_Stelem_DoWrite
NESTED_END
; ------------------------------------------------------------------
; __declspec(naked) void F_CALL_CONV JIT_Stelem_DoWrite(PtrArray* array, unsigned idx, Object* val)
LEAF_ENTRY JIT_Stelem_DoWrite
; Setup args for JIT_WriteBarrier. x14 = &array->m_array[idx] x15 = val
add x14, x0, #PtrArray__m_Array ; x14 = &array->m_array
add x14, x14, x1, LSL #3
mov x15, x2 ; x15 = val
; Branch to the write barrier (which is already correctly overwritten with
; single or multi-proc code based on the current CPU
b JIT_WriteBarrier
LEAF_END
#ifdef PROFILING_SUPPORTED
; ------------------------------------------------------------------
; void JIT_ProfilerEnterLeaveTailcallStub(UINT_PTR ProfilerHandle)
LEAF_ENTRY JIT_ProfilerEnterLeaveTailcallStub
ret lr
LEAF_END
#define PROFILE_ENTER 1
#define PROFILE_LEAVE 2
#define PROFILE_TAILCALL 4
#define SIZEOF__PROFILE_PLATFORM_SPECIFIC_DATA 256
; ------------------------------------------------------------------
MACRO
GenerateProfileHelper $helper, $flags
LCLS __HelperNakedFuncName
__HelperNakedFuncName SETS "$helper":CC:"Naked"
IMPORT $helper
NESTED_ENTRY $__HelperNakedFuncName
; On entry:
; x10 = functionIDOrClientID
; x11 = profiledSp
; x12 = throwable
;
; On exit:
; Values of x0-x8, q0-q7, fp are preserved.
; Values of other volatile registers are not preserved.
PROLOG_SAVE_REG_PAIR fp, lr, -SIZEOF__PROFILE_PLATFORM_SPECIFIC_DATA! ; Allocate space and save Fp, Pc.
SAVE_ARGUMENT_REGISTERS sp, 16 ; Save x8 and argument registers (x0-x7).
str xzr, [sp, #88] ; Clear functionId.
SAVE_FLOAT_ARGUMENT_REGISTERS sp, 96 ; Save floating-point/SIMD registers (q0-q7).
add x12, fp, SIZEOF__PROFILE_PLATFORM_SPECIFIC_DATA ; Compute probeSp - initial value of Sp on entry to the helper.
stp x12, x11, [sp, #224] ; Save probeSp, profiledSp.
str xzr, [sp, #240] ; Clear hiddenArg.
mov w12, $flags
stp w12, wzr, [sp, #248] ; Save flags and clear unused field.
mov x0, x10
mov x1, sp
bl $helper
RESTORE_ARGUMENT_REGISTERS sp, 16 ; Restore x8 and argument registers.
RESTORE_FLOAT_ARGUMENT_REGISTERS sp, 96 ; Restore floating-point/SIMD registers.
EPILOG_RESTORE_REG_PAIR fp, lr, SIZEOF__PROFILE_PLATFORM_SPECIFIC_DATA!
EPILOG_RETURN
NESTED_END
0
MEND
GenerateProfileHelper ProfileEnter, PROFILE_ENTER
GenerateProfileHelper ProfileLeave, PROFILE_LEAVE
GenerateProfileHelper ProfileTailcall, PROFILE_TAILCALL
#endif
; Must be at very end of file
END
|
//*****************************************************************************
// Copyright 2017-2018 Intel Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//*****************************************************************************
#pragma once
#include "ngraph/op/op.hpp"
#include "ngraph/runtime/cpu/op/conv_bias.hpp"
#include "ngraph/runtime/cpu/op/quantized_conv.hpp"
namespace ngraph
{
namespace op
{
/// \brief Relu(Convolution) forward prop for batched convolution operation.
class QuantizedConvolutionRelu : public Op
{
public:
QuantizedConvolutionRelu(const std::shared_ptr<op::QuantizedConvolution>& qconv);
QuantizedConvolutionRelu(const std::shared_ptr<Node>& data_batch,
const std::shared_ptr<Node>& filters,
const Strides& window_movement_strides,
const Strides& window_dilation_strides,
const CoordinateDiff& padding_below,
const CoordinateDiff& padding_above,
const Strides& data_dilation_strides,
const std::shared_ptr<Node> min_input,
const std::shared_ptr<Node> max_input,
const std::shared_ptr<Node> min_filter,
const std::shared_ptr<Node> max_filter,
const std::shared_ptr<Node> min_freezed_output,
const std::shared_ptr<Node> max_freezed_output);
const Strides& get_window_movement_strides() const { return m_window_movement_strides; }
const Strides& get_window_dilation_strides() const { return m_window_dilation_strides; }
const CoordinateDiff& get_padding_below() const { return m_padding_below; }
const CoordinateDiff& get_padding_above() const { return m_padding_above; }
const Strides& get_data_dilation_strides() const { return m_data_dilation_strides; }
float get_input_min() const { return m_input_min; }
float get_input_max() const { return m_input_max; }
float get_filter_min() const { return m_filter_min; }
float get_filter_max() const { return m_filter_max; }
float get_freezed_output_min() const { return m_freezed_output_min; }
float get_freezed_output_max() const { return m_freezed_output_max; }
std::shared_ptr<Node> get_filters() { return get_argument(1); }
std::shared_ptr<Node> get_data_batch() { return get_argument(0); }
virtual std::shared_ptr<Node>
copy_with_new_args(const NodeVector& new_args) const override;
protected:
Strides m_window_movement_strides;
Strides m_window_dilation_strides;
CoordinateDiff m_padding_below;
CoordinateDiff m_padding_above;
Strides m_data_dilation_strides;
float m_input_min;
float m_input_max;
float m_filter_min;
float m_filter_max;
float m_freezed_output_min;
float m_freezed_output_max;
};
}
}
|
// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "perception/linux_syscalls/utime.h"
#include "perception/debug.h"
namespace perception {
namespace linux_syscalls {
long utime() {
perception::DebugPrinterSingleton << "System call utime is unimplemented.\n";
return 0;
}
}
}
|
; A319534: Number of integers x such that 1 <= x <= n and gcd(x,n) = gcd(x+2,n) = gcd(x+6,n) = 1.
; Submitted by Jon Maiga
; 1,1,1,2,2,1,4,4,3,2,8,2,10,4,2,8,14,3,16,4,4,8,20,4,10,10,9,8,26,2,28,16,8,14,8,6,34,16,10,8,38,4,40,16,6,20,44,8,28,10,14,20,50,9,16,16,16,26,56,4,58,28,12,32,20,8,64,28,20,8,68,12,70,34,10,32,32,10,76,16,27,38,80,8,28,40,26,32,86,6,40,40,28,44,32,16,94,28,24,20
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 $5,1
lpb $0
dif $0,$2
mul $5,$2
lpe
dif $5,$2
mul $1,$5
trn $2,4
add $2,1
mul $1,$2
lpe
mov $0,$1
|
; Copyright (c) 2015 Jeremy Dilatush
; All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions
; are met:
; 1. Redistributions of source code must retain the above copyright
; notice, this list of conditions and the following disclaimer.
; 2. Redistributions in binary form must reproduce the above copyright
; notice, this list of conditions and the following disclaimer in the
; documentation and/or other materials provided with the distribution.
;
; THIS SOFTWARE IS PROVIDED BY JEREMY DILATUSH 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 JEREMY DILATUSH 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.
; For testing my 6502 based "VTJ-1" platform and the "booty" file transfer
; programs. The main point of this is to have a large file transfer,
; to test performance and accurancy. Thus, it loads a large amount of
; data and a little program that performs a checksum on it.
; note: This has just been run and not really tested.
; Memory areas it loads into:
; $8000 - $afff -- the 8kB text RAM and 4kB font RAM are filled with data
; $c000 - $efff -- the bottom 12kB of ROM are also filled with data
; $f000 - ? -- and here's the program
; Once it's all loaded and the program is run, it computes a 16 byte check
; code and transmits it, in hex, repeatedly on the serial port at 9600 baud.
; It also sets the LEDs as it works through the math. Counts down as
; bytes of check code are completed, from 15 to 0; then counts up as it
; transmits lines.
; The check code is composed of sixteen single-byte subcodes, each computed
; by running the same function over the input with different starting value:
; initial value: 0-15 depending on position
; with each input byte:
; add the byte (one's complement)
; rotate the value right 1 bit
; Intended assembler: crasm
cpu 6502
code
; Basic system info
D1BASE = $8000 ; base of 1st data chunk 4kB long; must be divisible by 256
D2BASE = $9000 ; base of 2nd data chunk 4kB long; must be divisible by 256
D3BASE = $a000 ; base of 3rd data chunk 4kB long; must be divisible by 256
D4BASE = $c000 ; base of 4th data chunk 4kB long; must be divisible by 256
D5BASE = $d000 ; base of 5th data chunk 4kB long; must be divisible by 256
D6BASE = $e000 ; base of 6th data chunk 4kB long; must be divisible by 256
PBASE = $f000 ; base of the program itself
LEDOUT = $b280 ; write LED state
SER_BASE = $b800 ; base of serial port registers
SER_INFO = $0 ; offset of serial port information byte
SER_TX = $1 ; register to transmit a byte
SER_RX = $2 ; register to receive a byte
SER_ST = $3 ; register to query device status
SER_TA = $4 ; transmit control byte A
SER_TB = $5 ; transmit control byte B
SER_RA = $6 ; receive control byte A
SER_RB = $7 ; receive control byte B
SER_LBL = $10 ; start of an ASCIIZ label
ICTL_PEA0 = $b040 ; interrupt control: pending slot 0-7 alpha IRQs
ICTL_PEA1 = $b041 ; interrupt control: pending slot 8-15 alpha IRQs
ICTL_PEB0 = $b048 ; interrupt control: pending slot 0-7 beta IRQs
ICTL_PEB1 = $b049 ; interrupt control: pending slot 8-15 beta IRQs
ICTL_PEPR = $b080 ; interrupt control: highest priority pending IRQ
; pseudo random data starts
* = D1BASE
db $7d, $b2, $c3, $50, $70, $16, $c4, $00
db $1b, $10, $18, $2d, $8e, $3a, $34, $b1
db $5d, $7e, $b7, $0a, $2d, $c5, $ab, $b1
db $d1, $d3, $46, $53, $dd, $5a, $b6, $1a
db $14, $49, $17, $05, $80, $bd, $f7, $8e
db $f0, $57, $74, $5a, $ea, $64, $c8, $eb
db $76, $2a, $54, $da, $76, $66, $cd, $9b
db $16, $1d, $e7, $ad, $d5, $e5, $eb, $67
db $a7, $9a, $36, $a6, $52, $ee, $21, $06
db $13, $29, $e0, $92, $2c, $e4, $92, $38
db $4d, $6f, $d9, $db, $55, $3f, $c5, $3d
db $85, $89, $f9, $30, $e3, $fc, $0d, $9a
db $bd, $17, $97, $63, $a8, $68, $ba, $13
db $62, $6a, $07, $4d, $dc, $d2, $e1, $ed
db $c3, $8a, $88, $83, $f2, $6e, $0b, $57
db $19, $c7, $31, $c5, $93, $80, $d6, $c9
db $85, $5f, $c4, $98, $dd, $5c, $88, $8a
db $d7, $6c, $8e, $0a, $4a, $77, $c9, $60
db $17, $62, $ad, $85, $cd, $75, $c8, $4c
db $ab, $83, $90, $75, $e4, $02, $c0, $a1
db $0e, $07, $e6, $e4, $ee, $cf, $f3, $37
db $f3, $ba, $0d, $5d, $42, $88, $69, $ec
db $b1, $57, $92, $cd, $ae, $a8, $32, $85
db $78, $af, $fb, $a5, $2e, $7a, $a0, $9f
db $9a, $f9, $00, $c1, $cf, $70, $ff, $02
db $f3, $ec, $0a, $2f, $4f, $16, $2f, $6d
db $08, $4c, $b7, $74, $e8, $b5, $0c, $52
db $de, $f4, $4a, $b6, $05, $c6, $28, $2e
db $63, $a4, $5e, $fe, $2d, $12, $fe, $81
db $ea, $c2, $6f, $92, $6b, $bf, $78, $9e
db $c0, $53, $2d, $68, $5c, $01, $77, $59
db $da, $74, $bf, $c9, $fe, $cb, $7d, $19
db $33, $f5, $74, $da, $02, $75, $9d, $19
db $81, $5f, $f5, $44, $1f, $ab, $7b, $67
db $02, $c1, $e2, $05, $bb, $6e, $92, $91
db $5c, $4d, $c0, $a1, $5f, $0f, $c4, $e0
db $cc, $00, $be, $7e, $6b, $0a, $f6, $fa
db $71, $8e, $e3, $dc, $3b, $06, $56, $08
db $c7, $f4, $39, $f3, $72, $aa, $5f, $dc
db $65, $f3, $bf, $8f, $f0, $e8, $e5, $b4
db $32, $88, $85, $73, $31, $13, $57, $43
db $d5, $7b, $6a, $94, $a0, $bf, $89, $66
db $1c, $f4, $10, $18, $cd, $04, $f2, $59
db $1a, $a5, $a9, $52, $b2, $f0, $e7, $e1
db $65, $c3, $eb, $89, $c3, $5a, $28, $e7
db $8d, $1b, $ef, $8d, $ee, $1b, $7e, $98
db $48, $c5, $2b, $20, $ae, $05, $66, $d4
db $cb, $53, $67, $8f, $f3, $d9, $77, $58
db $9f, $6d, $ec, $7f, $c9, $53, $aa, $5e
db $65, $fd, $cb, $d6, $99, $b0, $4a, $2c
db $cc, $e5, $e9, $e4, $19, $46, $34, $88
db $de, $ed, $25, $ea, $8d, $3c, $a9, $40
db $90, $5f, $92, $57, $88, $a9, $c6, $b9
db $44, $1c, $6a, $aa, $43, $26, $f7, $7c
db $27, $ff, $38, $26, $42, $ff, $69, $df
db $e8, $5b, $25, $df, $6f, $9c, $61, $b0
db $b4, $ce, $b6, $d7, $40, $40, $a2, $10
db $4b, $e6, $8c, $e9, $6d, $2a, $d4, $8a
db $f9, $e1, $e1, $e5, $81, $b9, $fe, $b1
db $67, $93, $a1, $82, $55, $6e, $dc, $79
db $8f, $ab, $03, $71, $82, $32, $17, $76
db $3f, $6a, $cb, $84, $53, $df, $6a, $64
db $6d, $41, $8d, $be, $47, $f7, $c3, $4f
db $11, $bb, $bb, $7b, $10, $1e, $3b, $25
db $99, $7a, $76, $ec, $03, $8a, $64, $e9
db $18, $ae, $3a, $5c, $ad, $1e, $35, $99
db $75, $6c, $2e, $ca, $cc, $8a, $8d, $ec
db $c5, $6b, $e6, $97, $33, $b4, $79, $54
db $3e, $00, $6e, $15, $22, $11, $ef, $1e
db $10, $a5, $a7, $da, $61, $2e, $b8, $76
db $5d, $31, $a5, $c7, $ee, $fd, $d9, $e2
db $9e, $0e, $82, $5b, $07, $66, $1a, $89
db $56, $1c, $09, $ac, $1e, $51, $c0, $48
db $fb, $89, $fc, $da, $56, $1a, $1e, $a1
db $e1, $06, $5c, $da, $83, $bb, $5f, $a9
db $f3, $2d, $21, $8f, $d9, $ac, $61, $88
db $0b, $b5, $14, $73, $c3, $5b, $4b, $ad
db $44, $34, $18, $a5, $77, $8b, $00, $78
db $27, $e2, $d7, $9a, $3f, $e3, $be, $f5
db $28, $4b, $86, $61, $a9, $38, $d0, $fa
db $92, $9d, $9f, $d3, $26, $5f, $d6, $31
db $2e, $1d, $b6, $b9, $0c, $87, $8b, $21
db $b6, $76, $49, $f5, $38, $2f, $08, $31
db $74, $42, $1c, $e7, $8e, $d9, $9b, $a4
db $c6, $13, $f1, $96, $51, $1b, $f9, $84
db $ba, $f2, $54, $1a, $86, $09, $df, $de
db $d3, $33, $80, $82, $c0, $2c, $15, $63
db $c3, $e7, $ba, $d4, $64, $83, $10, $fa
db $81, $80, $b3, $82, $70, $b9, $c2, $4b
db $17, $6f, $5b, $4e, $fc, $e0, $ae, $ed
db $6b, $d0, $af, $e3, $ed, $48, $5f, $1e
db $07, $b4, $22, $2f, $01, $f3, $97, $1b
db $65, $77, $8f, $39, $76, $03, $4b, $e6
db $1d, $17, $78, $05, $91, $02, $ee, $e6
db $34, $6f, $a0, $a9, $d2, $e5, $a7, $9d
db $8a, $a5, $c3, $ee, $a6, $b9, $5b, $f9
db $b3, $83, $19, $d3, $a8, $d8, $70, $9e
db $05, $59, $61, $46, $bf, $67, $85, $90
db $2a, $7e, $a6, $6c, $4c, $2b, $8b, $b0
db $b8, $92, $39, $82, $75, $84, $9f, $15
db $2c, $33, $f4, $c4, $35, $52, $5b, $eb
db $04, $14, $36, $54, $47, $94, $cf, $46
db $e8, $ee, $2f, $4b, $36, $d8, $8d, $44
db $14, $fc, $dd, $c1, $05, $63, $14, $b0
db $89, $02, $9a, $cd, $de, $97, $26, $39
db $e9, $48, $b2, $5f, $63, $a8, $c9, $a8
db $ca, $1d, $76, $96, $f6, $b6, $1f, $4b
db $f3, $b1, $62, $df, $5e, $3c, $74, $38
db $c0, $53, $54, $9c, $0b, $82, $db, $fb
db $78, $2a, $1e, $8e, $66, $f7, $47, $ae
db $34, $d1, $21, $68, $01, $2b, $4d, $96
db $b5, $a6, $a8, $c2, $2d, $bb, $fb, $b4
db $ff, $7d, $15, $8c, $c0, $2f, $f0, $dd
db $06, $fc, $ca, $37, $3d, $fd, $c2, $51
db $ce, $be, $fc, $93, $10, $da, $99, $6c
db $e2, $21, $3d, $a0, $e4, $ad, $da, $de
db $5f, $83, $c4, $f9, $fb, $a5, $01, $d3
db $15, $04, $93, $50, $39, $af, $8d, $bd
db $17, $eb, $ef, $f4, $34, $31, $68, $64
db $e3, $df, $e4, $95, $4e, $eb, $65, $26
db $58, $68, $b5, $2d, $68, $62, $98, $6c
db $fb, $d3, $53, $12, $54, $40, $30, $b2
db $41, $c5, $0c, $e9, $c4, $2e, $f0, $f7
db $42, $94, $5f, $d6, $91, $d8, $f5, $b2
db $20, $59, $27, $0e, $f1, $30, $0e, $f3
db $0b, $17, $8b, $62, $78, $b9, $4f, $f5
db $71, $2d, $9f, $0a, $da, $6b, $75, $2d
db $65, $cb, $9c, $f0, $36, $cc, $bf, $f6
db $4f, $0a, $97, $e9, $d7, $5d, $76, $3b
db $21, $bc, $df, $86, $db, $26, $98, $14
db $02, $0b, $37, $17, $cd, $b2, $b9, $fe
db $87, $89, $ac, $ee, $f6, $3e, $6e, $fa
db $82, $47, $05, $0b, $e8, $b6, $0b, $13
db $56, $d5, $fa, $52, $9d, $9e, $90, $69
db $4b, $3b, $a6, $fa, $b3, $81, $e5, $7a
db $d3, $6f, $df, $8c, $e1, $03, $d2, $20
db $69, $b1, $86, $0d, $b6, $96, $02, $8f
db $a5, $4a, $5f, $b7, $a2, $d8, $42, $9f
db $84, $06, $42, $8a, $14, $31, $65, $90
db $1b, $56, $a9, $b9, $38, $5d, $f5, $91
db $0b, $23, $89, $55, $f4, $7f, $8a, $4e
db $40, $2b, $2f, $73, $eb, $25, $0f, $1d
db $fc, $57, $99, $d0, $13, $e7, $72, $6a
db $aa, $07, $fa, $4a, $2e, $57, $7d, $36
db $dc, $67, $71, $27, $7e, $be, $33, $d2
db $1e, $91, $f0, $50, $d9, $08, $f8, $2d
db $87, $c4, $f5, $9f, $ae, $ad, $36, $6a
db $d6, $45, $5d, $9d, $42, $58, $da, $0a
db $6e, $3e, $e5, $dc, $98, $c1, $09, $ef
db $b2, $0e, $83, $e8, $d1, $bd, $c9, $0c
db $3f, $73, $c0, $f7, $55, $25, $ac, $69
db $ef, $2e, $79, $6c, $9e, $0c, $c0, $26
db $17, $a3, $d0, $8d, $2c, $0e, $05, $9e
db $33, $e8, $bd, $ff, $55, $46, $84, $9e
db $52, $75, $eb, $d1, $a9, $72, $fa, $e6
db $58, $d2, $c6, $88, $09, $da, $b0, $fd
db $f6, $ac, $32, $26, $f4, $b1, $f5, $6c
db $6a, $d7, $4b, $b6, $36, $06, $48, $b6
db $f7, $fb, $b8, $d0, $15, $dd, $0d, $77
db $39, $9e, $89, $d5, $23, $24, $56, $3f
db $4c, $c8, $d8, $ba, $79, $7d, $e5, $59
db $cf, $5a, $b1, $2d, $aa, $d8, $5d, $6d
db $78, $c8, $b0, $60, $26, $92, $b3, $bf
db $f0, $9b, $de, $64, $93, $90, $77, $0e
db $05, $cd, $09, $8a, $2b, $49, $cf, $25
db $6d, $c3, $2c, $e2, $e4, $6a, $0b, $a5
db $07, $f2, $3d, $ec, $b8, $33, $6d, $12
db $06, $11, $4e, $c0, $30, $8f, $c8, $08
db $fd, $d4, $4d, $47, $48, $ba, $5b, $88
db $67, $de, $c9, $fe, $96, $77, $30, $8f
db $88, $42, $27, $6f, $cf, $7e, $08, $38
db $17, $b9, $fb, $d3, $f4, $64, $5c, $a3
db $09, $b6, $db, $83, $91, $e7, $5d, $43
db $8b, $6b, $b0, $04, $a7, $ef, $aa, $92
db $4d, $b1, $18, $05, $db, $45, $34, $60
db $45, $36, $a8, $e9, $3b, $84, $ae, $39
db $72, $0e, $21, $27, $d7, $4a, $1e, $30
db $87, $4b, $78, $4c, $83, $19, $7a, $d7
db $1b, $26, $8b, $d1, $b6, $6f, $ed, $27
db $ff, $d7, $a7, $72, $3f, $95, $d2, $bf
db $8e, $88, $e3, $e3, $f1, $38, $19, $6b
db $f4, $81, $3a, $80, $29, $e3, $90, $a5
db $29, $5d, $3b, $5d, $90, $f3, $4e, $82
db $d7, $06, $3a, $7c, $53, $57, $16, $09
db $2a, $27, $39, $f5, $e1, $af, $93, $b3
db $06, $b3, $90, $69, $9a, $d9, $85, $38
db $a3, $95, $dc, $d1, $51, $6d, $2e, $ee
db $7c, $f1, $cf, $70, $12, $91, $a4, $77
db $27, $73, $93, $14, $31, $03, $db, $87
db $41, $55, $6c, $e1, $1d, $9a, $f6, $bd
db $ee, $3a, $52, $40, $5f, $de, $6b, $09
db $a4, $97, $cf, $48, $a0, $e6, $48, $b6
db $7e, $fe, $cd, $14, $71, $b8, $96, $64
db $fd, $5c, $d2, $9e, $be, $53, $cf, $fb
db $ba, $75, $14, $bc, $63, $57, $b5, $a6
db $00, $a2, $13, $58, $ef, $5e, $f6, $5c
db $5a, $96, $ef, $6a, $6e, $14, $f8, $eb
db $c1, $55, $58, $85, $c5, $e4, $1e, $72
db $e1, $00, $bc, $00, $20, $e1, $df, $01
db $02, $65, $61, $c9, $05, $e4, $15, $20
db $f5, $df, $f0, $40, $79, $0f, $9e, $31
db $dd, $88, $28, $9e, $bb, $3e, $00, $44
db $9f, $09, $58, $b6, $d5, $d1, $62, $18
db $b2, $17, $5b, $8a, $cb, $43, $ed, $e5
db $f9, $aa, $ea, $63, $4d, $4d, $f7, $e3
db $38, $68, $2d, $31, $6f, $51, $73, $72
db $d0, $b5, $fc, $6c, $54, $1c, $d3, $5e
db $52, $67, $a8, $97, $1c, $06, $d8, $43
db $6b, $78, $d7, $60, $b9, $0a, $62, $08
db $25, $d0, $94, $f7, $b3, $25, $5e, $84
db $15, $1e, $71, $c9, $59, $75, $02, $ca
db $b1, $c2, $e0, $b6, $f4, $cb, $ea, $68
db $c1, $77, $26, $ea, $a7, $3b, $fd, $41
db $9c, $9b, $c4, $65, $2e, $a5, $ed, $8c
db $f4, $ed, $90, $53, $f7, $9f, $a4, $4a
db $13, $c9, $5a, $ac, $92, $8e, $11, $d6
db $6c, $66, $02, $0c, $26, $d1, $8a, $1a
db $97, $a7, $47, $35, $20, $47, $8e, $fc
db $cd, $7a, $99, $2a, $6b, $0d, $67, $35
db $89, $c5, $f7, $e8, $89, $cc, $b5, $99
db $9e, $10, $47, $c4, $45, $51, $94, $3a
db $ba, $92, $e3, $53, $9a, $34, $24, $d0
db $7e, $59, $09, $ed, $b9, $54, $06, $48
db $bc, $12, $9d, $45, $27, $f8, $6d, $e2
db $4a, $e7, $5b, $11, $23, $f2, $d3, $35
db $45, $8b, $1f, $22, $de, $9c, $19, $14
db $b9, $d2, $45, $9f, $da, $fe, $4f, $0f
db $0a, $0c, $27, $2c, $da, $65, $04, $7e
db $0c, $e3, $7d, $60, $66, $94, $7a, $0f
db $2b, $0f, $bc, $5d, $36, $ee, $4f, $df
db $fe, $3d, $5b, $2e, $2e, $6b, $8f, $89
db $22, $b6, $15, $42, $a2, $da, $b7, $f5
db $18, $40, $61, $4e, $5c, $58, $77, $40
db $0b, $78, $75, $42, $8e, $9e, $c6, $bf
db $f4, $55, $dd, $fa, $b6, $a6, $a6, $0c
db $e6, $d0, $69, $26, $8f, $be, $83, $d7
db $3d, $8c, $69, $a3, $33, $21, $22, $71
db $f6, $c6, $21, $ec, $af, $26, $b1, $7d
db $fe, $e8, $76, $13, $44, $3f, $1c, $66
db $29, $ae, $51, $57, $b4, $da, $c8, $13
db $ac, $07, $29, $0f, $ec, $24, $45, $d3
db $c4, $fe, $94, $fd, $e2, $ca, $33, $5b
db $1b, $99, $92, $10, $c9, $9b, $63, $c5
db $07, $2f, $8e, $b0, $89, $b4, $7d, $65
db $a6, $41, $1f, $ed, $0c, $86, $2d, $41
db $3f, $d1, $df, $03, $f5, $73, $53, $a9
db $b6, $45, $9f, $66, $95, $3e, $2c, $4e
db $61, $08, $92, $89, $97, $6b, $06, $f6
db $d3, $23, $77, $cf, $83, $13, $2f, $10
db $69, $53, $e8, $b7, $06, $10, $7f, $4f
db $62, $0e, $4e, $72, $7e, $67, $fc, $ac
db $1e, $a6, $45, $5e, $96, $11, $36, $52
db $83, $1e, $76, $df, $e0, $47, $83, $69
db $77, $cf, $7a, $89, $0f, $cb, $ba, $00
db $c9, $d2, $13, $51, $91, $03, $cc, $ff
db $52, $61, $49, $7f, $f0, $a6, $24, $2d
db $e7, $ee, $43, $d9, $4f, $b2, $9d, $52
db $5b, $6b, $f9, $27, $e8, $61, $67, $3d
db $4b, $79, $70, $d7, $70, $9b, $e7, $d8
db $1a, $9c, $fe, $85, $26, $ac, $e2, $06
db $4e, $2b, $b7, $7f, $6b, $9b, $f8, $82
db $c4, $16, $ad, $8c, $20, $f1, $db, $e8
db $fd, $71, $94, $43, $e3, $72, $4b, $a4
db $57, $41, $e3, $f7, $8d, $cd, $fc, $c9
db $61, $f7, $8b, $82, $8c, $12, $17, $a7
db $5a, $85, $dd, $f7, $31, $d3, $b5, $1f
db $68, $7d, $11, $81, $1e, $4d, $6c, $6c
db $8d, $9d, $89, $a1, $12, $81, $29, $75
db $9d, $ce, $c3, $ad, $f3, $24, $16, $07
db $24, $26, $df, $ef, $af, $8e, $c6, $2e
db $7a, $ae, $cf, $cf, $89, $12, $c0, $13
db $7a, $8a, $fe, $7b, $5d, $35, $f8, $fb
db $8d, $60, $73, $2b, $6d, $3c, $4b, $ff
db $f1, $be, $54, $a0, $2b, $d7, $5d, $6a
db $8b, $10, $56, $a7, $d3, $b2, $ad, $bf
db $5d, $36, $57, $a6, $3a, $52, $54, $d8
db $2b, $6f, $b1, $33, $1b, $03, $2a, $ba
db $07, $6d, $0b, $90, $7a, $a4, $2a, $09
db $f4, $de, $ac, $c5, $c5, $e8, $02, $d7
db $6d, $1a, $00, $39, $02, $d3, $68, $f5
db $a3, $b8, $96, $40, $f4, $0a, $b0, $ae
db $40, $a3, $5a, $fc, $47, $d1, $f8, $a2
db $69, $0d, $3c, $03, $ea, $bd, $e0, $81
db $b9, $96, $0c, $70, $96, $27, $b2, $0c
db $77, $b0, $12, $9b, $1a, $5e, $b7, $d4
db $20, $ad, $97, $27, $fe, $f7, $de, $57
db $e3, $df, $72, $8a, $3e, $7a, $9e, $9b
db $37, $75, $1b, $b9, $b4, $32, $29, $34
db $6f, $2e, $b5, $4e, $b3, $3d, $41, $1c
db $e4, $c9, $d0, $96, $1b, $4b, $cd, $05
db $72, $c3, $1e, $c9, $b3, $d6, $9f, $89
db $be, $a8, $2a, $15, $3a, $76, $36, $a7
db $fc, $bc, $80, $b7, $f3, $65, $3c, $16
db $a6, $ed, $5e, $66, $9d, $31, $c0, $0b
db $64, $63, $d7, $a0, $21, $89, $0a, $14
db $c4, $c8, $d3, $ce, $71, $99, $38, $e3
db $bd, $90, $26, $91, $7e, $22, $17, $c0
db $d2, $ae, $31, $bc, $c9, $26, $3a, $80
db $4a, $1f, $61, $1c, $ff, $73, $b4, $b4
db $33, $11, $33, $b7, $32, $ca, $f7, $4d
db $2a, $17, $89, $1d, $e5, $69, $a7, $42
db $d0, $21, $6b, $de, $cd, $ec, $8f, $a4
db $81, $76, $0b, $20, $54, $41, $fa, $8a
db $c0, $d9, $f8, $e8, $66, $16, $93, $6b
db $e3, $e1, $99, $b5, $94, $b6, $1d, $84
db $77, $e3, $b5, $00, $85, $51, $00, $94
db $1a, $a8, $ce, $c2, $61, $98, $98, $a0
db $c7, $0e, $80, $46, $74, $48, $55, $b7
db $c0, $22, $ee, $04, $7a, $a6, $e8, $8a
db $23, $0f, $16, $20, $45, $9b, $c2, $27
db $40, $b7, $44, $be, $78, $12, $3f, $67
db $9e, $fc, $f0, $60, $de, $fa, $98, $d7
db $55, $04, $ef, $c6, $52, $97, $d6, $14
db $87, $e6, $f8, $65, $a0, $6e, $f7, $88
db $32, $01, $3c, $12, $92, $d6, $f7, $c3
db $90, $3d, $0e, $cd, $79, $de, $21, $0d
db $31, $b8, $0b, $37, $b3, $b5, $bc, $e0
db $c0, $6c, $76, $80, $bd, $ef, $91, $27
db $ec, $79, $30, $d9, $80, $7a, $8e, $fd
db $25, $ce, $bd, $70, $ec, $71, $02, $ae
db $36, $ad, $e5, $44, $45, $d4, $76, $b1
db $eb, $c4, $22, $db, $05, $4e, $4f, $f6
db $a2, $5d, $61, $7a, $22, $cb, $15, $97
db $5f, $8c, $a5, $22, $e2, $9d, $d3, $51
db $58, $8e, $00, $6c, $f5, $a2, $17, $96
db $57, $31, $9e, $5a, $8b, $ef, $e5, $bb
db $11, $28, $c4, $89, $3c, $76, $d1, $2e
db $f5, $1f, $ae, $7d, $ec, $1e, $3d, $71
db $d8, $b1, $d3, $df, $89, $4d, $3a, $4c
db $c7, $84, $a6, $ad, $3f, $39, $f9, $b8
db $88, $21, $a1, $35, $d4, $3d, $b2, $20
db $42, $b2, $25, $8b, $21, $02, $ce, $05
db $37, $21, $24, $6b, $b5, $d8, $16, $9a
db $b9, $ce, $bb, $3d, $da, $ea, $18, $bd
db $93, $d4, $ef, $66, $be, $28, $33, $59
db $eb, $df, $e4, $98, $93, $90, $7c, $26
db $0d, $f7, $d7, $5f, $7e, $d9, $0a, $73
db $2e, $54, $17, $00, $56, $85, $15, $15
db $96, $e7, $9f, $96, $76, $d7, $f9, $3c
db $30, $74, $b7, $62, $4b, $6f, $c6, $72
db $e8, $cc, $64, $76, $90, $7e, $3a, $fc
db $67, $12, $38, $48, $f7, $74, $02, $0a
db $bf, $8f, $34, $b2, $2d, $77, $79, $42
db $3a, $d8, $57, $51, $b4, $d4, $79, $b7
db $8c, $4c, $07, $1d, $b6, $7c, $cd, $d4
db $ee, $30, $1b, $9d, $36, $31, $12, $15
db $cb, $ed, $42, $99, $8b, $a4, $69, $8c
db $ac, $b6, $bb, $20, $c1, $d7, $ff, $d1
db $77, $89, $21, $40, $87, $d5, $b0, $a6
db $f9, $1a, $75, $0a, $06, $1f, $a8, $2a
db $7e, $0b, $b8, $67, $2f, $e1, $0f, $04
db $38, $1b, $bb, $83, $dc, $6b, $99, $5b
db $a6, $8d, $3f, $e9, $36, $9f, $72, $49
db $09, $89, $90, $8a, $97, $40, $f2, $c3
db $47, $20, $eb, $d1, $1d, $92, $cb, $d9
db $0f, $32, $41, $a3, $b5, $5f, $90, $f1
db $0b, $bc, $47, $8a, $ae, $c7, $56, $59
db $53, $53, $bb, $64, $ff, $e6, $6d, $76
db $43, $52, $7d, $c9, $35, $a9, $2f, $1a
db $cf, $13, $23, $9c, $5c, $13, $74, $e8
db $b7, $33, $64, $6f, $dc, $8f, $60, $a0
db $aa, $44, $bc, $38, $65, $6a, $b2, $13
db $4d, $e1, $89, $66, $ec, $11, $bd, $ad
db $40, $14, $4f, $3c, $27, $3c, $2e, $6b
db $06, $22, $b8, $76, $aa, $cc, $c2, $66
db $0d, $ed, $df, $ff, $41, $ae, $91, $47
db $11, $35, $e4, $13, $c5, $34, $3d, $8e
db $e2, $19, $57, $f6, $e3, $0a, $0d, $c1
db $db, $b7, $75, $12, $12, $c2, $27, $72
db $39, $f6, $b0, $de, $9a, $9c, $c9, $7c
db $ba, $6b, $fe, $d5, $e9, $b7, $34, $89
db $8f, $ea, $cb, $33, $52, $9b, $44, $8d
db $e9, $64, $be, $03, $8f, $71, $08, $2d
db $62, $0a, $67, $6b, $c7, $ad, $32, $2e
db $9e, $63, $03, $25, $ce, $fa, $37, $35
db $5a, $0a, $9f, $71, $2e, $eb, $09, $4f
db $d2, $79, $52, $0a, $c6, $f5, $0a, $4c
db $c6, $ec, $74, $29, $3e, $0c, $88, $8d
db $f8, $5c, $1c, $7c, $b9, $d8, $b2, $4f
db $d2, $20, $b6, $d2, $83, $84, $22, $3d
db $22, $a6, $9b, $b0, $19, $e0, $75, $1e
db $c2, $c4, $14, $b9, $20, $9f, $29, $62
db $8b, $07, $54, $d0, $e1, $e9, $10, $80
db $b2, $e7, $5c, $2f, $a7, $fa, $43, $13
db $1c, $ac, $a9, $09, $ac, $e2, $81, $9a
db $cb, $01, $a1, $77, $5f, $ec, $c1, $77
db $bd, $40, $98, $4f, $c5, $07, $46, $f0
db $09, $d7, $43, $82, $8b, $e5, $6d, $82
db $b6, $c3, $d4, $c7, $5a, $bb, $1f, $03
db $13, $5b, $f2, $bb, $dd, $b7, $0b, $4e
db $8a, $da, $b3, $f5, $92, $f9, $09, $7b
db $20, $45, $82, $4f, $b2, $e1, $14, $ed
db $b2, $d9, $76, $1e, $1b, $f1, $32, $26
db $6f, $d9, $f0, $c1, $11, $4b, $e5, $d2
db $0b, $b8, $6a, $8d, $94, $7c, $46, $b2
db $e8, $6e, $35, $9d, $20, $0b, $db, $83
db $c5, $93, $d6, $1b, $f8, $be, $e1, $e7
db $ed, $56, $13, $6f, $cb, $fc, $e4, $51
db $f8, $7d, $c1, $b3, $b1, $4f, $37, $c3
db $4f, $e2, $87, $9a, $d2, $e1, $2e, $f6
db $26, $56, $72, $84, $24, $3b, $b4, $12
db $70, $97, $2e, $1d, $aa, $89, $57, $6b
db $1b, $cf, $25, $01, $a0, $1e, $c8, $0c
db $5a, $59, $47, $8a, $1c, $d9, $a7, $03
db $b8, $61, $e3, $4b, $a2, $67, $9c, $15
db $bf, $38, $31, $d7, $60, $eb, $02, $d1
db $16, $53, $ed, $7d, $17, $c2, $c6, $d1
db $f5, $7a, $8c, $ed, $a5, $df, $c5, $d9
db $f3, $f1, $ca, $0d, $0a, $0b, $c7, $23
db $4a, $8d, $6a, $3d, $7d, $1c, $ae, $bf
db $96, $72, $16, $eb, $97, $23, $9c, $69
db $b2, $71, $f9, $0b, $b9, $6b, $8a, $df
db $d8, $0e, $ee, $b9, $b5, $10, $7a, $81
db $ee, $32, $89, $4e, $b0, $bc, $0f, $74
db $3b, $19, $91, $a5, $97, $51, $10, $f0
db $8a, $52, $50, $5c, $98, $33, $1c, $2a
db $88, $ef, $e1, $e9, $67, $59, $42, $a5
db $4c, $45, $86, $77, $2c, $c7, $da, $bc
db $f6, $52, $dd, $88, $05, $08, $cc, $87
db $03, $30, $0b, $89, $e3, $51, $76, $6d
db $bd, $3a, $31, $cc, $f0, $2e, $a9, $d2
db $5c, $2c, $6e, $75, $17, $ad, $cf, $d2
db $af, $e1, $a3, $ed, $1e, $92, $c3, $01
db $68, $62, $1a, $d8, $cd, $66, $33, $e0
db $94, $cc, $1f, $f4, $ec, $75, $84, $4f
db $9a, $c3, $9d, $c6, $58, $14, $74, $aa
db $a7, $ad, $17, $a4, $8b, $85, $81, $81
db $5e, $24, $e1, $d3, $ea, $08, $97, $d1
db $e5, $c9, $7d, $66, $69, $57, $b0, $cb
db $fa, $99, $bc, $ac, $78, $b6, $0f, $00
db $57, $9b, $fb, $c1, $89, $33, $47, $a7
db $43, $a2, $0e, $b6, $15, $53, $08, $03
db $00, $76, $48, $e1, $b5, $ca, $d4, $a7
db $0a, $2c, $b5, $bf, $4b, $87, $1a, $c4
db $30, $be, $bc, $f8, $7d, $8d, $fb, $2a
db $47, $4a, $5a, $30, $68, $5c, $aa, $b7
db $11, $eb, $fc, $c8, $51, $8d, $01, $5b
db $a9, $07, $23, $c7, $de, $8e, $50, $1a
db $de, $be, $38, $a1, $75, $91, $21, $67
db $b2, $90, $fc, $ab, $85, $15, $0f, $55
db $79, $24, $3b, $36, $d1, $45, $d6, $e9
db $87, $c6, $d4, $ac, $5a, $08, $fc, $cb
db $ba, $60, $04, $e9, $a7, $c1, $58, $e8
db $96, $00, $86, $b6, $d1, $83, $4a, $25
db $38, $1a, $80, $fb, $08, $a4, $38, $d4
db $3d, $ae, $4a, $29, $81, $f8, $ed, $85
db $f5, $8a, $72, $6b, $cb, $3a, $3f, $c8
db $37, $73, $36, $17, $75, $e7, $f0, $1e
db $8a, $dc, $03, $7f, $34, $0e, $2c, $e9
db $07, $9f, $bf, $dc, $6b, $73, $0a, $98
db $fe, $df, $d2, $3b, $93, $a5, $89, $a2
db $c6, $c7, $3c, $c0, $9d, $0d, $42, $fd
db $de, $8d, $90, $d7, $22, $70, $33, $bb
db $bc, $02, $c9, $c3, $d6, $4e, $5a, $8a
db $b3, $4f, $6a, $6d, $ee, $04, $79, $5b
db $94, $60, $68, $b9, $a5, $45, $51, $55
db $ce, $60, $d9, $83, $a7, $cb, $2c, $e8
db $60, $1d, $a4, $5a, $7a, $46, $92, $47
db $76, $58, $03, $ee, $51, $1c, $6f, $7a
db $d8, $eb, $7b, $b7, $6b, $2d, $73, $80
db $aa, $e2, $12, $f2, $0f, $da, $6d, $89
db $1a, $6c, $38, $c3, $63, $22, $11, $8a
db $2f, $d3, $9f, $5d, $d4, $e5, $90, $fb
db $0b, $6f, $b1, $76, $88, $f6, $02, $f0
db $1f, $2e, $4d, $db, $79, $ba, $e5, $08
db $22, $73, $3c, $95, $c5, $bc, $80, $c2
db $02, $7b, $0a, $fa, $a5, $4d, $24, $69
db $42, $02, $93, $5b, $2d, $5a, $08, $cd
db $90, $4f, $94, $ce, $8d, $a0, $2b, $28
db $78, $c1, $66, $04, $3d, $c9, $cc, $94
db $04, $e5, $27, $f9, $48, $4d, $1b, $97
db $fa, $07, $49, $fe, $6f, $18, $05, $6a
db $16, $8b, $d3, $54, $93, $ce, $43, $b2
db $f3, $00, $a1, $36, $34, $dc, $4f, $18
db $a2, $fb, $c7, $aa, $b7, $10, $06, $fc
db $33, $4f, $a5, $14, $4c, $0f, $a0, $90
db $b6, $6c, $97, $db, $83, $70, $ea, $3d
db $b9, $3c, $9e, $01, $54, $09, $fc, $11
db $3e, $61, $7f, $0b, $01, $2c, $1d, $7d
db $e5, $9c, $8c, $85, $5a, $b9, $73, $e0
db $2f, $08, $54, $5d, $ff, $92, $03, $1e
db $f3, $68, $28, $34, $73, $50, $77, $35
db $41, $80, $1f, $40, $ee, $f5, $0f, $a9
db $2b, $a0, $ad, $97, $1b, $f9, $4e, $cf
db $e2, $d2, $cd, $98, $4e, $42, $87, $2f
db $dd, $b9, $e2, $8e, $ae, $79, $c5, $5b
db $b4, $9a, $84, $42, $78, $68, $56, $38
db $6e, $6f, $80, $5d, $5b, $83, $95, $2b
db $a8, $15, $7f, $40, $f0, $bf, $8e, $9a
db $4b, $31, $2a, $de, $6e, $95, $37, $06
db $62, $a2, $18, $da, $f6, $2b, $36, $7f
db $82, $89, $31, $f4, $44, $35, $a1, $ed
db $07, $ad, $ff, $20, $23, $c2, $3b, $23
db $fd, $2d, $28, $f5, $b2, $f4, $69, $12
db $6d, $82, $73, $4c, $0c, $10, $20, $32
db $72, $1f, $c5, $62, $4e, $59, $67, $94
db $73, $1b, $db, $52, $b6, $03, $5b, $e1
db $70, $ef, $01, $56, $23, $70, $24, $60
db $df, $ea, $12, $0d, $07, $ad, $81, $77
db $50, $94, $87, $26, $22, $89, $17, $d8
db $c9, $3f, $76, $7f, $98, $4a, $57, $f4
db $a6, $85, $93, $0d, $f7, $26, $8e, $12
db $cf, $28, $82, $e1, $c5, $50, $96, $59
db $aa, $ef, $3c, $dd, $b1, $ef, $3d, $2b
db $fb, $bd, $99, $98, $54, $8a, $62, $a4
db $e5, $9f, $68, $77, $71, $a2, $fb, $1b
db $05, $25, $7a, $17, $d0, $98, $88, $57
db $fb, $de, $43, $47, $af, $7f, $e1, $f3
db $1a, $11, $96, $b9, $29, $e7, $e1, $ad
db $a0, $bb, $69, $e8, $43, $d5, $f9, $b3
db $65, $f9, $b5, $5d, $11, $34, $4b, $ee
db $94, $4c, $da, $ef, $f3, $6e, $77, $4b
* = D2BASE
db $9c, $97, $6d, $7f, $04, $42, $33, $6b
db $d9, $51, $99, $43, $65, $1a, $61, $8a
db $9d, $d9, $7b, $c1, $69, $6d, $35, $d2
db $8f, $6d, $b1, $3e, $63, $e0, $9a, $8a
db $5e, $62, $dd, $80, $35, $dc, $f0, $08
db $cd, $75, $4f, $24, $02, $e7, $6a, $39
db $ff, $0b, $f8, $e6, $c0, $d7, $cd, $9c
db $83, $7a, $af, $a8, $79, $16, $52, $be
db $f8, $9e, $6d, $26, $c5, $b4, $94, $6f
db $6b, $cf, $2d, $e2, $f7, $02, $a2, $fb
db $34, $97, $d6, $62, $c7, $eb, $86, $c1
db $c4, $36, $5a, $43, $06, $55, $e9, $4c
db $d1, $50, $20, $c4, $3e, $ff, $46, $2c
db $69, $c4, $8c, $41, $42, $9c, $df, $f7
db $ff, $a4, $98, $0a, $a5, $ed, $6d, $e7
db $cc, $3d, $14, $52, $e5, $45, $c3, $20
db $e2, $35, $9d, $33, $a7, $42, $c1, $39
db $31, $d5, $38, $15, $91, $0b, $48, $ba
db $96, $87, $d9, $c7, $5e, $78, $ed, $f7
db $32, $09, $15, $70, $6d, $84, $e1, $20
db $87, $96, $d0, $37, $8d, $d1, $3e, $1e
db $49, $6b, $1a, $55, $0c, $61, $b8, $4a
db $1a, $a9, $ea, $f5, $3a, $72, $56, $6a
db $29, $0a, $ac, $bf, $36, $0b, $4f, $51
db $64, $38, $50, $01, $ab, $36, $2d, $26
db $33, $0a, $c5, $41, $0b, $03, $8f, $1c
db $97, $2f, $3a, $84, $7f, $0e, $ff, $77
db $a5, $15, $ed, $09, $87, $29, $40, $6d
db $19, $ee, $21, $d4, $f6, $b8, $ee, $46
db $3d, $23, $0e, $06, $33, $6e, $f9, $d1
db $3f, $5e, $82, $3d, $45, $ef, $80, $c3
db $54, $98, $2e, $c1, $fd, $6b, $23, $fd
db $de, $aa, $11, $d9, $a3, $0d, $0f, $fc
db $73, $a3, $99, $c6, $76, $14, $7b, $5b
db $19, $a2, $85, $22, $25, $76, $8f, $af
db $80, $2c, $dc, $bd, $d0, $a1, $bb, $c4
db $3f, $a4, $2d, $70, $54, $63, $7b, $d3
db $11, $20, $17, $f3, $a3, $bb, $84, $d6
db $88, $00, $af, $4d, $a4, $82, $c8, $20
db $ea, $46, $45, $44, $23, $8a, $7b, $da
db $b6, $5f, $dd, $3f, $0a, $f9, $ca, $1d
db $e4, $ae, $40, $fc, $9b, $15, $2b, $82
db $d1, $95, $f7, $9e, $3a, $27, $a4, $f7
db $09, $27, $db, $c1, $5b, $9c, $e2, $86
db $25, $28, $2c, $7e, $86, $92, $6f, $ef
db $97, $e3, $54, $34, $93, $37, $d7, $7a
db $4a, $1a, $f8, $4d, $25, $16, $2d, $d0
db $c0, $fc, $1f, $ae, $9c, $1e, $5d, $03
db $80, $cf, $5c, $6f, $a9, $bb, $31, $f7
db $8d, $07, $31, $1a, $f4, $23, $68, $af
db $c0, $21, $2a, $5b, $90, $20, $fa, $4a
db $cb, $24, $b0, $29, $15, $78, $85, $85
db $16, $3e, $59, $b3, $58, $00, $f1, $78
db $45, $9a, $a0, $fc, $27, $40, $ea, $88
db $82, $5c, $39, $fe, $b2, $cc, $a9, $66
db $c1, $d5, $c5, $32, $fd, $d5, $76, $3e
db $78, $ab, $3c, $96, $3a, $83, $7a, $49
db $04, $f2, $ff, $db, $0f, $57, $af, $73
db $a9, $5b, $0b, $d7, $d9, $f5, $b4, $59
db $63, $7d, $c9, $47, $8a, $aa, $c7, $c5
db $2a, $f2, $37, $12, $4e, $ac, $fb, $69
db $14, $1d, $bf, $e3, $4d, $72, $ab, $d4
db $83, $06, $20, $02, $95, $64, $18, $d4
db $7f, $84, $c6, $a0, $b1, $80, $a7, $9a
db $cf, $fb, $d7, $f6, $e3, $e8, $9a, $dc
db $e7, $fe, $1c, $df, $0b, $ff, $25, $b9
db $07, $80, $e7, $5f, $2a, $71, $cc, $4b
db $f2, $84, $84, $55, $5f, $f6, $9d, $e8
db $bb, $55, $74, $37, $ab, $dd, $51, $70
db $8e, $f1, $36, $c1, $d6, $1b, $ea, $3f
db $fa, $4c, $1f, $67, $b9, $6c, $31, $71
db $a0, $20, $7a, $5b, $0e, $b3, $07, $c5
db $26, $54, $f0, $7a, $73, $28, $7e, $3c
db $c8, $5d, $57, $a2, $fb, $9f, $37, $8a
db $24, $58, $81, $3e, $53, $77, $6f, $2d
db $20, $21, $2b, $b6, $9b, $66, $a4, $94
db $75, $6c, $1b, $47, $4e, $46, $71, $40
db $9a, $70, $e5, $1c, $f8, $24, $29, $2e
db $53, $36, $d8, $d8, $a4, $31, $46, $33
db $8e, $8c, $37, $f7, $56, $f4, $21, $d1
db $52, $d2, $90, $48, $da, $aa, $ad, $00
db $74, $57, $94, $0c, $ea, $9e, $b6, $db
db $95, $62, $7b, $dc, $a9, $a7, $94, $f9
db $06, $07, $37, $14, $03, $3d, $02, $86
db $67, $09, $0b, $9a, $08, $3f, $7a, $d0
db $2f, $69, $d5, $27, $f2, $80, $02, $b2
db $33, $99, $38, $b2, $b5, $d9, $2d, $e4
db $ec, $61, $7e, $ff, $ba, $35, $f7, $32
db $d9, $18, $c1, $76, $8a, $a7, $8a, $bf
db $3a, $2f, $e0, $a3, $83, $ba, $ac, $20
db $1a, $9d, $c5, $65, $85, $79, $a6, $09
db $3d, $a8, $4e, $a6, $a0, $88, $d3, $3f
db $9f, $a1, $cc, $f6, $e3, $93, $2e, $62
db $7a, $71, $eb, $91, $be, $c2, $09, $c0
db $2b, $7d, $39, $be, $c6, $74, $f9, $ad
db $3d, $ee, $62, $fa, $af, $f3, $c1, $8a
db $d7, $e9, $1e, $18, $6c, $78, $47, $e4
db $a2, $4c, $18, $c8, $a3, $a9, $42, $f2
db $1b, $0e, $4f, $6f, $84, $e2, $77, $8f
db $d8, $6c, $e9, $28, $d4, $12, $c7, $f0
db $56, $ca, $e8, $d2, $57, $ef, $98, $15
db $07, $0b, $72, $14, $b2, $46, $bf, $bf
db $0e, $af, $be, $ab, $7e, $e8, $08, $53
db $8f, $df, $4e, $93, $60, $6c, $1e, $76
db $87, $94, $38, $86, $8b, $63, $79, $d2
db $3a, $0b, $b3, $df, $87, $5c, $56, $0a
db $2e, $c1, $be, $c5, $1f, $c1, $9c, $67
db $a6, $10, $97, $06, $ac, $8f, $dc, $c8
db $df, $00, $4f, $aa, $d0, $2c, $81, $79
db $bf, $95, $3e, $bc, $4d, $42, $b0, $5a
db $2d, $50, $ac, $8f, $1f, $b9, $db, $fc
db $f1, $e9, $bf, $fc, $a1, $17, $a1, $08
db $af, $31, $8c, $44, $71, $83, $d2, $9c
db $2e, $20, $45, $4e, $9d, $62, $62, $01
db $21, $d7, $72, $fe, $4b, $2a, $d3, $aa
db $f6, $df, $f2, $2b, $e7, $1d, $2e, $64
db $0d, $09, $eb, $00, $9d, $2b, $dc, $e1
db $fd, $91, $a2, $c0, $06, $e0, $38, $d6
db $78, $df, $7f, $80, $48, $6e, $13, $94
db $bd, $1d, $2c, $e4, $dd, $f3, $9c, $a2
db $a7, $ca, $69, $d9, $ff, $7f, $6b, $4b
db $0e, $ac, $32, $d5, $db, $62, $26, $0a
db $0c, $ad, $88, $95, $3c, $b3, $ce, $d7
db $d4, $b8, $02, $92, $1d, $53, $01, $fe
db $e5, $bb, $b5, $bd, $ba, $0e, $6c, $fe
db $e2, $19, $aa, $a9, $46, $8d, $73, $9b
db $9a, $cc, $a6, $5d, $7d, $80, $5f, $70
db $b3, $03, $61, $98, $8a, $cf, $ed, $e9
db $bc, $a4, $46, $67, $d1, $a8, $f5, $af
db $45, $ef, $bc, $89, $32, $12, $65, $76
db $11, $86, $0a, $d4, $ee, $aa, $3b, $69
db $d1, $21, $4d, $86, $10, $65, $da, $d6
db $ff, $ee, $29, $52, $48, $49, $dc, $75
db $df, $26, $48, $d5, $77, $76, $8d, $81
db $b5, $d6, $05, $4c, $e0, $f0, $1d, $d0
db $68, $e5, $17, $98, $3d, $0a, $1d, $82
db $18, $db, $21, $0c, $04, $07, $70, $5e
db $f2, $1a, $f1, $97, $e0, $62, $c6, $6e
db $92, $b8, $95, $75, $81, $a7, $55, $13
db $a0, $56, $58, $7c, $f3, $2e, $5b, $94
db $52, $f7, $91, $f1, $aa, $2f, $df, $1c
db $cb, $b7, $ec, $25, $14, $78, $bf, $1f
db $ce, $9f, $ea, $61, $ff, $32, $81, $bd
db $96, $6c, $05, $9d, $1c, $4e, $17, $14
db $c2, $a5, $80, $3f, $b0, $f0, $fc, $a3
db $9f, $24, $0d, $b7, $26, $08, $17, $48
db $52, $2d, $b4, $4a, $f3, $6a, $dc, $9b
db $87, $51, $03, $d1, $a7, $5f, $ed, $8d
db $8c, $f0, $88, $a1, $07, $ed, $bf, $73
db $aa, $18, $9d, $89, $d3, $63, $29, $a3
db $d9, $be, $a1, $b0, $8e, $6f, $e0, $1e
db $f6, $9c, $e4, $93, $94, $b4, $c5, $a8
db $df, $4b, $86, $9c, $42, $0d, $e0, $34
db $7d, $3a, $72, $34, $4e, $e4, $a4, $82
db $36, $8c, $99, $0d, $49, $c4, $30, $2d
db $09, $d6, $e0, $db, $06, $c3, $19, $06
db $52, $ce, $30, $03, $53, $e9, $68, $7f
db $c7, $10, $fc, $20, $8b, $3c, $81, $ce
db $7a, $3e, $ea, $b2, $f1, $4b, $48, $a6
db $8a, $83, $5a, $61, $b2, $cd, $6a, $c5
db $13, $8e, $36, $09, $31, $e5, $1c, $f3
db $93, $51, $41, $0b, $b4, $37, $6e, $38
db $b1, $83, $4f, $f4, $b5, $ca, $ef, $3f
db $ff, $5c, $4e, $39, $f8, $a5, $c9, $dc
db $30, $31, $d5, $55, $ba, $4d, $ef, $16
db $51, $cf, $80, $7d, $85, $48, $3a, $08
db $5e, $22, $04, $dd, $21, $8e, $2d, $f9
db $d3, $be, $5d, $ca, $b4, $20, $26, $85
db $24, $d9, $ba, $75, $01, $b8, $01, $cb
db $ad, $12, $ef, $9d, $22, $f8, $dc, $f2
db $e7, $21, $3c, $20, $fb, $88, $c9, $6f
db $67, $ad, $52, $ff, $e2, $97, $59, $9b
db $1f, $12, $21, $28, $90, $eb, $2f, $a8
db $19, $c5, $1f, $6b, $a1, $a0, $8f, $c6
db $3e, $5c, $4b, $55, $f4, $52, $77, $19
db $26, $03, $3f, $bf, $4c, $f9, $9a, $92
db $86, $55, $56, $2c, $8b, $30, $b4, $70
db $b7, $bc, $ce, $01, $7d, $bb, $53, $54
db $1d, $ca, $b3, $c5, $17, $80, $c0, $f7
db $46, $a9, $0e, $e2, $fc, $f1, $db, $e5
db $49, $59, $cb, $c3, $d0, $76, $65, $8b
db $9d, $ef, $c8, $ff, $a6, $1d, $13, $3e
db $84, $7c, $e2, $40, $fd, $7c, $95, $3c
db $14, $e3, $0e, $29, $8f, $0f, $94, $e5
db $61, $61, $bd, $e2, $e9, $e3, $36, $45
db $51, $7d, $ee, $4c, $90, $23, $8f, $5f
db $ea, $f0, $df, $78, $2a, $8c, $fa, $07
db $33, $f4, $09, $d9, $ca, $69, $6a, $60
db $45, $39, $fa, $52, $e0, $7f, $9b, $3d
db $fa, $5d, $05, $5a, $cc, $92, $f0, $33
db $14, $98, $b6, $9a, $85, $77, $19, $e9
db $40, $1e, $0a, $e4, $6d, $b6, $d1, $17
db $6e, $7c, $6c, $5d, $8c, $12, $41, $1d
db $a5, $98, $ba, $1c, $68, $8b, $79, $52
db $17, $64, $24, $0a, $2b, $89, $8f, $98
db $ef, $a5, $ce, $e5, $82, $09, $73, $ba
db $0a, $77, $c8, $d2, $db, $cd, $d4, $04
db $04, $94, $6f, $7d, $2a, $eb, $0a, $ad
db $cd, $5f, $78, $27, $f3, $68, $c9, $44
db $d8, $10, $b5, $2b, $e2, $6f, $4a, $28
db $7d, $15, $b8, $30, $87, $41, $5a, $b6
db $d8, $a9, $66, $42, $a2, $33, $cb, $8f
db $3b, $87, $cd, $4c, $3a, $be, $bb, $4a
db $89, $c2, $14, $4f, $aa, $64, $56, $00
db $b3, $1d, $ae, $6e, $5b, $b0, $32, $f8
db $74, $57, $84, $0b, $aa, $00, $c0, $66
db $b9, $fa, $75, $36, $b2, $51, $f8, $80
db $c5, $f9, $21, $69, $da, $78, $db, $69
db $15, $8d, $12, $9f, $ca, $b9, $87, $63
db $0d, $af, $21, $65, $cd, $66, $c0, $aa
db $af, $36, $9d, $97, $49, $9e, $72, $28
db $9e, $80, $72, $14, $a8, $1c, $68, $9c
db $d7, $86, $f3, $2a, $70, $ec, $6f, $1a
db $02, $70, $1e, $9c, $de, $60, $79, $3c
db $e2, $18, $58, $74, $2c, $3e, $f2, $16
db $fc, $d0, $a4, $65, $46, $df, $02, $da
db $27, $c5, $56, $50, $be, $60, $82, $18
db $45, $39, $2a, $d7, $1b, $bb, $58, $9c
db $d0, $76, $eb, $af, $73, $4d, $47, $3c
db $bb, $5b, $9b, $b7, $69, $19, $18, $35
db $b8, $8f, $ac, $9e, $ee, $7b, $ee, $06
db $4d, $54, $0d, $53, $dd, $1e, $3e, $85
db $46, $5f, $21, $e3, $35, $b0, $3d, $9e
db $12, $30, $b6, $4f, $37, $e7, $97, $ad
db $12, $56, $e0, $56, $d3, $b4, $66, $2a
db $02, $89, $e1, $3e, $aa, $79, $57, $5d
db $21, $d1, $8b, $86, $12, $9f, $23, $9f
db $91, $90, $49, $e5, $0e, $80, $93, $0e
db $1a, $82, $e5, $11, $ad, $a6, $a9, $69
db $a6, $49, $03, $82, $b3, $8b, $83, $8c
db $5a, $21, $ba, $92, $cf, $45, $f7, $3a
db $0a, $b3, $da, $b3, $46, $a2, $f2, $f8
db $80, $b2, $0a, $5c, $10, $83, $24, $34
db $45, $a0, $54, $0e, $9a, $9f, $7e, $fe
db $23, $10, $72, $7a, $d3, $98, $9c, $77
db $33, $c4, $0e, $5c, $c8, $27, $88, $53
db $96, $16, $13, $a7, $a4, $b5, $c6, $d5
db $6f, $76, $ea, $9e, $de, $93, $4f, $74
db $b5, $fd, $82, $2e, $98, $e9, $07, $8e
db $d4, $d9, $86, $85, $c3, $ad, $6e, $c2
db $10, $dc, $5a, $54, $4d, $be, $0f, $69
db $e2, $e2, $0e, $ac, $f8, $e6, $44, $cd
db $db, $22, $1a, $cc, $31, $79, $49, $ba
db $f5, $20, $af, $37, $f7, $43, $3a, $49
db $bf, $7c, $48, $41, $73, $bb, $a3, $18
db $b9, $cc, $6a, $6f, $47, $f5, $85, $fa
db $6f, $45, $7f, $d2, $94, $25, $b5, $f6
db $c3, $c7, $93, $8d, $c4, $5e, $16, $bf
db $d8, $34, $92, $cc, $4c, $87, $51, $f8
db $1b, $24, $87, $e9, $ab, $79, $98, $6e
db $17, $23, $19, $44, $42, $5d, $92, $d1
db $cc, $18, $e1, $39, $ab, $3e, $16, $7b
db $54, $c3, $3b, $b7, $8c, $c4, $44, $d2
db $fa, $3b, $c6, $88, $ad, $e9, $54, $e7
db $48, $3b, $cd, $67, $6d, $f7, $09, $fa
db $51, $49, $52, $ea, $6b, $f1, $27, $01
db $8f, $35, $18, $6a, $d9, $f2, $78, $86
db $ac, $a3, $f5, $3b, $6e, $c0, $77, $7b
db $9b, $73, $49, $69, $2a, $53, $5a, $32
db $6d, $8b, $64, $33, $2b, $70, $8c, $f6
db $33, $07, $5a, $44, $dd, $e7, $ae, $4d
db $ec, $ae, $c0, $1b, $46, $1e, $48, $c6
db $ec, $54, $2e, $69, $04, $fa, $72, $6b
db $ce, $15, $ea, $a9, $1d, $94, $5a, $8e
db $a2, $9e, $f7, $2b, $b9, $2c, $95, $5a
db $60, $25, $db, $72, $d1, $74, $86, $4c
db $c4, $a3, $b0, $99, $59, $24, $21, $43
db $cc, $ad, $96, $a5, $2e, $c7, $4b, $75
db $c2, $23, $2a, $81, $04, $42, $09, $fb
db $ef, $3a, $c8, $85, $4d, $77, $37, $44
db $37, $50, $6b, $41, $0a, $d0, $49, $88
db $c6, $4f, $7a, $e5, $d4, $26, $59, $47
db $af, $85, $30, $f4, $a2, $91, $cd, $4e
db $7a, $39, $f5, $c2, $2f, $7c, $09, $3f
db $56, $69, $d9, $99, $56, $c3, $f5, $10
db $28, $19, $09, $aa, $f9, $f7, $40, $08
db $cf, $05, $3a, $7b, $43, $6b, $99, $7f
db $6f, $c6, $1b, $48, $5e, $98, $1d, $b0
db $7a, $0f, $41, $e0, $f5, $d1, $24, $b5
db $cd, $8f, $f2, $65, $c3, $55, $a9, $ca
db $f2, $58, $00, $f5, $11, $f6, $fe, $af
db $bd, $ab, $97, $9c, $19, $6e, $6e, $a0
db $23, $fd, $b0, $06, $68, $3a, $10, $5b
db $c9, $97, $e5, $3c, $9d, $82, $67, $7c
db $98, $4a, $56, $09, $52, $1b, $0f, $65
db $63, $b2, $31, $54, $f3, $9b, $0d, $84
db $66, $b3, $52, $14, $88, $ff, $2b, $e5
db $08, $99, $d2, $22, $a6, $d9, $52, $42
db $99, $6c, $6c, $61, $09, $4b, $60, $f9
db $ab, $9d, $7e, $62, $5d, $ab, $ff, $b7
db $ef, $a1, $7b, $4e, $72, $7e, $5e, $38
db $30, $3f, $e0, $d8, $2b, $ce, $18, $8a
db $d1, $41, $a8, $19, $18, $53, $60, $69
db $c4, $e3, $93, $b3, $22, $82, $37, $cd
db $49, $2f, $9c, $9c, $9d, $5b, $a2, $07
db $dc, $00, $8d, $68, $34, $5b, $e7, $9b
db $83, $e8, $ec, $d8, $d3, $e8, $2b, $d2
db $4b, $23, $3c, $e2, $4a, $e6, $e8, $f6
db $a4, $f6, $c4, $7c, $27, $1b, $e0, $2a
db $1c, $2d, $78, $11, $68, $71, $4d, $62
db $b6, $8f, $b5, $62, $92, $cf, $71, $3b
db $65, $fc, $d3, $1e, $4b, $3a, $ea, $9c
db $dc, $9c, $03, $e0, $85, $ca, $78, $7f
db $86, $a2, $d1, $ef, $aa, $e5, $7b, $3c
db $54, $38, $70, $df, $d4, $b2, $1b, $71
db $b4, $a1, $fe, $3d, $55, $38, $48, $a9
db $cb, $d9, $07, $80, $0b, $a7, $16, $6d
db $00, $67, $09, $54, $75, $a4, $c1, $3a
db $ac, $ac, $15, $c7, $47, $de, $bd, $b4
db $58, $25, $ac, $df, $72, $c6, $50, $1d
db $f5, $57, $a8, $5c, $b7, $f5, $88, $13
db $34, $61, $1d, $7f, $d5, $65, $a2, $5b
db $17, $99, $d8, $0d, $7f, $61, $25, $5c
db $0f, $47, $df, $d4, $67, $2e, $10, $ee
db $95, $b4, $49, $11, $cf, $a0, $c6, $55
db $12, $7b, $79, $f9, $27, $95, $b0, $e3
db $f8, $44, $c3, $c4, $76, $63, $c2, $52
db $90, $77, $0c, $23, $f9, $07, $2d, $c1
db $2d, $83, $16, $03, $4a, $2d, $e2, $b7
db $42, $9e, $1b, $b8, $6f, $f6, $ef, $cb
db $c4, $44, $a7, $68, $4d, $67, $b9, $3d
db $c8, $e1, $75, $4f, $a3, $25, $2d, $f9
db $d9, $cf, $c5, $8a, $c8, $1b, $bf, $94
db $a3, $b7, $60, $01, $03, $67, $1c, $b3
db $65, $e6, $9d, $8f, $3e, $35, $83, $07
db $48, $68, $4e, $05, $ad, $60, $a0, $9e
db $95, $fd, $54, $2e, $fa, $ca, $9a, $5a
db $ee, $4a, $1d, $eb, $63, $3a, $c1, $47
db $3a, $67, $92, $9b, $0c, $70, $68, $cf
db $df, $ad, $69, $47, $c4, $38, $dc, $9e
db $95, $b8, $d2, $10, $63, $9b, $8d, $e9
db $91, $db, $1a, $0d, $99, $d5, $8e, $62
db $f1, $56, $c6, $4e, $40, $53, $81, $d3
db $a2, $e9, $81, $06, $06, $b1, $7b, $df
db $fc, $68, $d5, $b3, $28, $d3, $69, $aa
db $b5, $ab, $81, $49, $0f, $53, $a5, $a2
db $d8, $fc, $8f, $6a, $81, $f9, $41, $fa
db $3c, $7f, $d5, $5b, $e0, $47, $59, $2b
db $08, $8c, $c9, $90, $0b, $00, $a5, $ff
db $64, $f5, $e5, $2a, $0b, $00, $b6, $ee
db $12, $f6, $fb, $28, $5c, $d9, $9a, $3c
db $90, $76, $1f, $d9, $9d, $65, $68, $d2
db $6f, $50, $88, $ff, $71, $1d, $3d, $13
db $78, $ab, $9e, $43, $9a, $6f, $8c, $4a
db $c8, $20, $96, $35, $44, $2f, $0f, $4e
db $41, $5b, $f3, $be, $f6, $62, $87, $10
db $1b, $ae, $bf, $ea, $99, $57, $28, $3d
db $1f, $f2, $c7, $91, $bf, $d9, $9d, $d1
db $86, $a1, $38, $20, $f9, $85, $65, $4a
db $db, $78, $78, $4f, $d1, $aa, $1f, $a6
db $e2, $66, $9d, $f5, $2b, $96, $c5, $0d
db $28, $e5, $b1, $f6, $c6, $0c, $7d, $87
db $39, $95, $a7, $e1, $48, $3c, $7e, $a9
db $29, $fd, $30, $6b, $6d, $25, $39, $18
db $71, $32, $d2, $90, $84, $2d, $c1, $4e
db $ae, $c3, $aa, $5e, $b8, $df, $db, $9f
db $40, $f9, $06, $1f, $85, $82, $f9, $33
db $53, $74, $d2, $3b, $1c, $4e, $f3, $86
db $69, $1b, $12, $6b, $ad, $fa, $25, $b6
db $29, $83, $a4, $53, $dd, $e0, $2a, $75
db $43, $13, $74, $7f, $1e, $e6, $a6, $6e
db $a9, $76, $43, $38, $67, $d0, $bd, $76
db $7b, $82, $e7, $bf, $2b, $58, $3f, $d1
db $eb, $de, $61, $8a, $5c, $7d, $0d, $84
db $47, $a0, $aa, $cd, $0a, $e1, $95, $ce
db $38, $17, $d9, $2b, $54, $b5, $0b, $19
db $7d, $b0, $4a, $59, $69, $a4, $9e, $9f
db $ef, $7d, $e5, $9a, $1a, $18, $6b, $9b
db $ce, $fd, $67, $22, $17, $27, $d2, $b9
db $2a, $33, $10, $5f, $ae, $d4, $b6, $c7
db $99, $bf, $3b, $2f, $0b, $d1, $f9, $a4
db $03, $67, $9a, $32, $ab, $be, $a6, $86
db $5e, $8d, $4b, $44, $31, $2d, $7d, $81
db $8d, $26, $57, $d5, $b6, $2e, $62, $8c
db $34, $ed, $a3, $e8, $13, $14, $cc, $05
db $0c, $17, $2c, $dc, $e3, $cf, $8f, $91
db $4d, $16, $3c, $b1, $39, $80, $11, $b9
db $fe, $1b, $fe, $6c, $e7, $87, $c0, $96
db $e6, $4a, $a6, $70, $97, $66, $da, $1d
db $91, $95, $6d, $1c, $7f, $cd, $df, $13
db $16, $1f, $fb, $cb, $a3, $b1, $2e, $83
db $c1, $84, $9a, $f5, $9b, $a4, $c3, $f4
db $09, $c0, $5d, $32, $56, $7d, $d5, $1e
db $19, $cd, $8f, $ca, $65, $44, $87, $59
db $8b, $bf, $60, $0b, $79, $19, $fc, $b0
db $60, $ff, $da, $e0, $ea, $39, $4a, $30
db $57, $65, $ae, $4c, $e9, $5f, $c2, $1c
db $52, $41, $a6, $6d, $25, $cf, $46, $2e
db $58, $bb, $da, $57, $45, $14, $38, $16
db $48, $5a, $fc, $ad, $de, $71, $21, $ea
db $8d, $bd, $58, $7f, $30, $c9, $bc, $5e
db $e3, $93, $e5, $e7, $ee, $26, $40, $f1
db $96, $8c, $a0, $f1, $3f, $1c, $73, $dd
db $19, $e0, $a7, $45, $c0, $3a, $bc, $c2
db $41, $61, $69, $03, $5a, $53, $5d, $eb
db $7f, $d6, $93, $1e, $94, $1c, $8b, $73
db $4d, $17, $44, $54, $26, $cb, $32, $0f
db $78, $fe, $c1, $34, $02, $aa, $86, $af
db $b8, $0e, $ba, $45, $10, $a8, $d5, $13
db $09, $6c, $7c, $53, $7f, $b6, $53, $64
db $2c, $e0, $94, $a7, $7e, $4b, $6c, $ba
db $cf, $d6, $c6, $5d, $9e, $bf, $14, $92
db $5e, $61, $78, $1a, $db, $e0, $17, $ae
db $13, $b1, $72, $8b, $ce, $7a, $25, $1c
db $f7, $69, $9f, $7e, $df, $4d, $f2, $8a
db $6b, $81, $19, $98, $e3, $24, $b7, $08
db $c5, $3d, $b1, $0e, $b2, $99, $55, $d8
db $0f, $20, $a4, $97, $03, $68, $7b, $3d
db $3e, $90, $d0, $9f, $80, $5b, $83, $30
db $db, $1d, $6e, $bd, $51, $8e, $4c, $75
db $15, $47, $21, $8e, $3d, $77, $76, $15
db $6e, $30, $fb, $c5, $e7, $df, $72, $91
db $8d, $b5, $94, $9a, $5c, $52, $b8, $40
db $63, $bc, $63, $1c, $2c, $07, $0e, $86
db $89, $6f, $54, $45, $1d, $db, $c2, $ab
db $a6, $eb, $3f, $e5, $7d, $9a, $4a, $2f
db $19, $16, $f3, $e7, $1b, $5c, $6a, $9a
db $0f, $d1, $ae, $d0, $5a, $47, $17, $15
db $0c, $3d, $fd, $ef, $70, $08, $8f, $c2
db $3e, $84, $cb, $56, $36, $1c, $09, $a1
db $8a, $8d, $32, $7a, $b0, $4c, $85, $1c
db $08, $6a, $b7, $e1, $51, $12, $b8, $9d
db $26, $b4, $71, $4f, $c8, $72, $14, $e4
db $eb, $dc, $3f, $ba, $17, $4c, $53, $de
db $15, $28, $b7, $4e, $3a, $36, $52, $77
db $4c, $94, $8c, $0b, $75, $d7, $cc, $6f
db $7d, $e3, $44, $54, $14, $2e, $cd, $7e
db $66, $2a, $92, $1d, $ae, $8a, $88, $4b
db $4e, $52, $85, $bf, $87, $6e, $6d, $7f
db $0e, $e5, $76, $0f, $85, $63, $c2, $40
db $61, $2e, $65, $27, $62, $ab, $48, $ae
db $7c, $8e, $ed, $17, $5c, $45, $e2, $03
db $97, $1a, $a6, $83, $83, $db, $ad, $67
db $4c, $0e, $39, $12, $20, $39, $b0, $01
db $e9, $c4, $d8, $60, $75, $d9, $7d, $9b
db $54, $a3, $14, $ec, $89, $cf, $86, $2b
db $6e, $1c, $97, $26, $69, $e0, $51, $c7
db $7d, $47, $e1, $a9, $2d, $3c, $a1, $dd
db $d5, $c0, $51, $c5, $63, $5c, $54, $ce
db $3a, $f0, $6b, $33, $d2, $de, $bc, $d8
db $14, $34, $2b, $9b, $e2, $d9, $f5, $f7
db $c3, $33, $f9, $7f, $72, $f9, $8f, $42
db $67, $38, $fb, $eb, $66, $b8, $9c, $d2
db $63, $b0, $b3, $80, $ee, $04, $a1, $a4
db $4f, $a1, $b3, $8e, $37, $75, $2b, $74
db $74, $38, $5e, $e9, $ee, $8f, $77, $27
db $84, $94, $66, $85, $0a, $0e, $39, $6d
db $e7, $e2, $3d, $4d, $42, $fa, $d8, $10
db $ff, $b4, $35, $eb, $91, $66, $86, $55
db $98, $0c, $27, $93, $9a, $f9, $33, $a2
db $37, $1b, $ee, $b5, $41, $ed, $db, $d0
db $97, $9b, $5c, $d6, $62, $15, $39, $0e
db $77, $55, $54, $9c, $c6, $ae, $11, $33
db $cc, $14, $22, $ce, $7b, $60, $70, $fb
db $43, $a4, $eb, $6f, $f9, $49, $3e, $3b
db $70, $27, $3a, $08, $db, $4e, $19, $ff
db $a6, $f5, $55, $0b, $c5, $62, $57, $25
db $29, $70, $70, $c5, $7a, $2e, $2f, $ac
db $4e, $a0, $d3, $ba, $51, $d5, $be, $d3
db $2c, $af, $b7, $c6, $16, $71, $fe, $1c
db $e1, $61, $7d, $38, $35, $0c, $33, $00
db $25, $10, $da, $c9, $eb, $32, $ac, $87
db $a8, $5b, $b6, $6a, $8d, $d1, $38, $a8
db $b9, $87, $fa, $8d, $71, $9e, $a1, $3d
db $34, $f6, $b8, $fe, $bd, $e9, $04, $cd
db $2b, $bc, $af, $13, $9e, $91, $63, $de
db $85, $2d, $1b, $77, $b4, $43, $94, $7f
db $59, $1f, $55, $42, $60, $a1, $a6, $6c
db $54, $59, $fc, $78, $ed, $12, $86, $45
db $08, $08, $69, $1f, $43, $42, $ea, $5a
db $37, $5e, $8c, $6c, $a6, $d1, $06, $0d
db $61, $84, $92, $59, $a7, $d4, $8d, $4e
db $67, $71, $2d, $17, $d4, $83, $89, $64
db $96, $f0, $78, $97, $02, $e0, $06, $73
db $c2, $ec, $98, $a4, $34, $1a, $6c, $bb
db $8e, $e7, $9b, $14, $23, $0e, $58, $61
db $3a, $d8, $26, $5e, $ea, $58, $54, $6f
db $86, $93, $67, $11, $10, $e3, $6b, $14
db $3b, $92, $5f, $b0, $e4, $44, $c7, $93
db $db, $87, $4d, $98, $dd, $31, $cf, $0d
db $3f, $5d, $56, $89, $1b, $68, $84, $24
db $b1, $86, $76, $d8, $b2, $cd, $ba, $e2
db $9f, $cf, $f6, $df, $01, $eb, $50, $5e
db $21, $8b, $c7, $bc, $69, $4c, $2f, $bc
db $4a, $e1, $08, $69, $74, $49, $8b, $10
db $e2, $b9, $15, $97, $fe, $e1, $58, $8c
db $52, $49, $5b, $87, $61, $27, $9a, $c5
db $96, $25, $e5, $80, $95, $65, $d5, $54
db $be, $ff, $76, $c4, $d2, $df, $a6, $5f
db $49, $51, $23, $b3, $4e, $d3, $6e, $a3
db $9c, $be, $3a, $33, $01, $54, $e9, $83
db $91, $7e, $af, $d5, $eb, $34, $84, $05
db $36, $31, $3a, $47, $37, $4d, $8a, $bd
db $d3, $62, $a1, $49, $25, $83, $49, $43
db $29, $df, $0f, $9f, $45, $43, $71, $33
db $14, $31, $38, $8c, $bc, $62, $6d, $a5
db $23, $5c, $7f, $a8, $c1, $15, $dd, $80
db $98, $40, $90, $7d, $b7, $0c, $88, $06
db $07, $1f, $9c, $7a, $1c, $11, $a3, $5b
db $4a, $53, $71, $39, $68, $85, $07, $fa
db $35, $db, $4a, $8e, $f5, $f8, $cb, $66
db $19, $9c, $de, $07, $b8, $77, $69, $18
db $18, $95, $59, $a2, $43, $58, $33, $9d
db $64, $a4, $4a, $39, $2b, $d4, $76, $ec
db $c0, $43, $45, $af, $20, $b6, $d5, $67
db $25, $81, $8a, $b8, $f1, $bb, $1a, $56
db $df, $da, $4a, $d3, $1c, $5d, $8f, $13
db $f5, $de, $28, $28, $27, $15, $96, $f5
db $b3, $87, $d8, $e8, $1d, $cb, $91, $df
db $53, $10, $ea, $05, $a8, $22, $9d, $c2
db $c3, $13, $ed, $69, $a7, $ca, $9e, $ab
db $fc, $3f, $39, $a5, $8e, $ce, $66, $cb
* = D3BASE
db $6c, $1e, $3e, $7b, $5f, $d7, $4e, $7f
db $fe, $3a, $d6, $19, $02, $42, $53, $56
db $bc, $37, $10, $c2, $1a, $65, $73, $4a
db $41, $26, $36, $32, $93, $ee, $ae, $a2
db $72, $c9, $23, $62, $02, $44, $fb, $4b
db $b2, $6d, $14, $a6, $f5, $af, $73, $8b
db $a2, $88, $7a, $3b, $51, $cc, $74, $8d
db $4b, $e7, $51, $a1, $7a, $34, $3a, $b1
db $d1, $97, $0b, $bc, $fa, $05, $88, $45
db $c4, $1e, $13, $03, $aa, $a1, $d9, $e9
db $93, $80, $5d, $67, $01, $37, $59, $79
db $bc, $88, $d9, $a1, $1e, $27, $e1, $53
db $25, $a0, $99, $9e, $73, $d9, $30, $8f
db $1d, $a4, $f2, $2f, $e2, $2c, $a0, $e4
db $b2, $d9, $06, $80, $11, $41, $62, $2c
db $bf, $84, $63, $6b, $a3, $b7, $48, $43
db $9a, $12, $64, $e1, $80, $3c, $a9, $e9
db $55, $c6, $ea, $66, $da, $d8, $9c, $27
db $ce, $1f, $f7, $35, $64, $fa, $36, $32
db $37, $3c, $92, $47, $ae, $30, $33, $6d
db $a1, $1f, $2f, $c3, $de, $92, $76, $f1
db $be, $a7, $1b, $ef, $46, $b1, $dc, $f6
db $16, $cc, $af, $74, $ff, $77, $26, $13
db $12, $72, $a1, $3d, $64, $4c, $be, $fa
db $3a, $00, $d2, $f5, $0e, $b1, $52, $31
db $68, $81, $7d, $7f, $85, $dc, $fd, $9b
db $f8, $b9, $f8, $92, $1a, $b1, $e0, $19
db $ac, $b4, $f4, $38, $9c, $4d, $43, $fa
db $f7, $05, $8e, $b5, $ad, $4e, $4b, $45
db $4e, $57, $d8, $28, $22, $c1, $32, $d2
db $e1, $47, $79, $d7, $7e, $c7, $85, $25
db $48, $af, $28, $66, $47, $78, $7e, $21
db $c4, $ac, $1d, $5a, $66, $77, $7d, $7a
db $93, $ad, $d4, $c5, $63, $d9, $24, $3a
db $65, $82, $df, $1d, $55, $a1, $ca, $c0
db $08, $c7, $7a, $f1, $4a, $09, $cd, $f9
db $2a, $00, $9b, $c9, $f6, $95, $aa, $47
db $a6, $80, $fe, $8a, $37, $5b, $40, $4d
db $0d, $e3, $8a, $89, $e6, $70, $f9, $b0
db $2c, $b6, $fc, $bc, $f4, $6a, $da, $3e
db $d6, $c7, $50, $b7, $92, $d0, $c0, $2a
db $ca, $9b, $35, $9c, $0b, $9b, $31, $8d
db $dd, $a3, $81, $11, $ff, $2d, $3c, $d5
db $8e, $1d, $79, $83, $8f, $40, $95, $e9
db $6c, $12, $36, $a2, $29, $3d, $f0, $37
db $bd, $2d, $47, $a4, $e3, $01, $d4, $72
db $dc, $ab, $32, $a4, $6c, $df, $6c, $23
db $84, $47, $8e, $f3, $c4, $8c, $a2, $d6
db $d2, $fc, $ac, $b6, $67, $f6, $de, $d3
db $20, $91, $1c, $4d, $ce, $40, $2a, $d0
db $de, $fc, $d0, $3a, $c2, $e6, $a3, $18
db $ba, $b3, $f2, $d8, $a4, $94, $7f, $0f
db $8f, $cd, $2c, $8e, $9d, $82, $c1, $5b
db $07, $86, $7e, $13, $06, $40, $36, $17
db $b4, $66, $50, $d0, $12, $39, $b7, $e8
db $1f, $3b, $84, $01, $a3, $44, $03, $80
db $cb, $34, $40, $d5, $24, $26, $23, $2f
db $d6, $8e, $ec, $dd, $7d, $e3, $59, $0f
db $36, $bd, $84, $2a, $0f, $24, $72, $40
db $27, $00, $35, $7c, $55, $62, $51, $6d
db $87, $a8, $78, $69, $40, $64, $a5, $a8
db $ac, $33, $57, $af, $92, $98, $38, $66
db $54, $72, $d4, $f8, $57, $e8, $39, $85
db $e5, $a6, $ed, $65, $bd, $b8, $39, $3a
db $0f, $c8, $32, $5b, $a8, $2a, $cc, $39
db $c2, $78, $7f, $b5, $14, $ad, $1c, $c3
db $06, $4a, $a4, $02, $c7, $29, $8b, $78
db $01, $2a, $a8, $20, $3d, $f1, $fa, $cb
db $fc, $0f, $d8, $a2, $9f, $b1, $1d, $78
db $89, $8f, $95, $93, $50, $b9, $54, $8d
db $82, $38, $95, $ad, $b3, $dc, $46, $59
db $84, $db, $ad, $03, $61, $bb, $61, $ec
db $1a, $e9, $fb, $d0, $ff, $37, $16, $6c
db $3c, $52, $c2, $1b, $8c, $2c, $d4, $c1
db $ab, $cb, $c1, $e8, $28, $ca, $8e, $77
db $03, $53, $8f, $98, $9d, $ca, $fb, $d5
db $7b, $1b, $28, $f8, $88, $2a, $17, $c2
db $94, $81, $54, $56, $5e, $0b, $78, $e6
db $f8, $7b, $7d, $52, $b1, $8b, $ca, $44
db $db, $1a, $27, $70, $88, $c7, $00, $ea
db $fa, $f2, $40, $f3, $fe, $f5, $57, $51
db $d8, $56, $32, $45, $e2, $e2, $0f, $9e
db $ae, $77, $df, $67, $22, $d1, $ef, $a3
db $d9, $7b, $9c, $24, $f1, $56, $1e, $3a
db $14, $7c, $5d, $eb, $fb, $1f, $e7, $5e
db $7c, $37, $77, $dc, $e6, $dd, $66, $ab
db $14, $97, $c1, $dd, $ef, $a2, $f0, $18
db $93, $c8, $23, $b9, $23, $d9, $d9, $da
db $96, $c0, $92, $e3, $27, $a8, $04, $12
db $c9, $56, $23, $2d, $ce, $2e, $13, $69
db $9b, $45, $a8, $ae, $51, $03, $2d, $40
db $ea, $44, $9b, $ff, $9d, $55, $92, $71
db $f0, $c8, $01, $31, $58, $75, $bb, $bc
db $9d, $b7, $8b, $2a, $6d, $4b, $e1, $ef
db $c9, $0b, $09, $04, $98, $f3, $56, $9c
db $f1, $0b, $e8, $46, $af, $0d, $3e, $58
db $e1, $df, $bc, $a0, $1a, $50, $33, $05
db $bc, $91, $42, $c5, $d7, $2d, $f5, $62
db $37, $01, $5a, $91, $08, $e1, $9f, $65
db $85, $50, $7a, $9a, $b2, $77, $ad, $82
db $59, $72, $f3, $50, $66, $d4, $fb, $1d
db $e6, $28, $29, $99, $b4, $6e, $fc, $8c
db $81, $a8, $21, $57, $bb, $00, $df, $a1
db $a9, $4f, $e2, $c0, $6e, $b6, $3a, $5e
db $a8, $1b, $3d, $de, $eb, $b6, $8c, $06
db $15, $48, $51, $2f, $0b, $d3, $0a, $28
db $3a, $4f, $6f, $38, $27, $b9, $a8, $4e
db $9a, $45, $0b, $2f, $ed, $24, $9a, $1a
db $1c, $56, $bf, $8b, $f5, $0f, $9b, $c8
db $e8, $ca, $c9, $30, $11, $13, $71, $1b
db $d9, $e0, $f9, $fb, $60, $43, $57, $c2
db $6e, $f9, $01, $71, $ce, $e2, $59, $ad
db $e4, $89, $21, $3b, $9c, $ea, $1f, $b6
db $1c, $bd, $f7, $12, $4d, $ea, $4c, $63
db $05, $11, $af, $23, $50, $e0, $84, $da
db $b0, $b2, $2b, $46, $e3, $06, $75, $9f
db $b7, $15, $76, $62, $b6, $18, $f7, $e6
db $e5, $3c, $b6, $d4, $b6, $79, $c5, $11
db $37, $c1, $6d, $2f, $93, $24, $a7, $20
db $a2, $47, $53, $0d, $8e, $63, $4f, $53
db $4f, $ae, $23, $68, $62, $9e, $c5, $32
db $d6, $94, $fc, $2d, $78, $42, $ae, $19
db $df, $fd, $4a, $62, $40, $f6, $fa, $fb
db $d8, $e7, $21, $98, $20, $5e, $30, $f3
db $98, $41, $25, $5e, $f4, $00, $84, $dd
db $3e, $2f, $ae, $a1, $a2, $c7, $d4, $a7
db $5d, $b0, $79, $f2, $41, $40, $5e, $a9
db $79, $ba, $cd, $86, $77, $ce, $a2, $d5
db $a6, $c7, $41, $42, $79, $ba, $30, $fc
db $18, $e1, $cd, $de, $40, $33, $76, $c8
db $fe, $bd, $69, $5e, $fc, $a6, $73, $6d
db $3d, $d7, $8b, $14, $c4, $17, $d1, $d2
db $0b, $17, $20, $db, $5e, $4a, $89, $f6
db $6b, $d7, $d5, $c2, $33, $a2, $0f, $c5
db $77, $de, $e9, $63, $db, $1a, $0d, $11
db $0d, $7d, $ef, $c4, $d3, $26, $a2, $4e
db $f9, $44, $d4, $5f, $5f, $dc, $4a, $0e
db $a0, $51, $e8, $58, $1e, $b2, $86, $5f
db $08, $93, $1d, $d9, $2d, $2e, $ac, $db
db $fc, $e5, $a5, $f1, $8e, $09, $66, $a8
db $d0, $24, $96, $99, $9f, $2b, $ac, $dd
db $b2, $2a, $97, $14, $d2, $ea, $6d, $29
db $69, $8b, $f1, $7b, $bd, $2c, $fe, $d6
db $84, $2e, $9b, $bf, $d8, $29, $51, $10
db $11, $f4, $05, $cd, $1f, $f4, $8b, $b5
db $8a, $64, $60, $49, $f9, $0f, $4d, $9e
db $2f, $1e, $66, $c5, $4e, $cd, $ec, $7b
db $12, $aa, $21, $c9, $6a, $60, $e2, $61
db $d3, $3b, $89, $3d, $e6, $ec, $3f, $e6
db $e2, $34, $59, $31, $10, $42, $0c, $b4
db $57, $d9, $5d, $1f, $65, $ae, $f4, $84
db $2d, $15, $47, $2d, $f6, $9a, $57, $e0
db $30, $3c, $bd, $db, $a4, $65, $3b, $e8
db $12, $43, $fa, $6d, $92, $d3, $6b, $0d
db $8f, $d5, $ff, $84, $a7, $fc, $40, $39
db $c6, $23, $9c, $5b, $36, $08, $dd, $fe
db $d5, $b0, $40, $b1, $a7, $ab, $13, $35
db $ee, $57, $6c, $9b, $6c, $ba, $38, $5b
db $58, $ed, $d0, $09, $d9, $97, $85, $07
db $7f, $e6, $d9, $be, $6e, $34, $4e, $47
db $c3, $d3, $ec, $14, $56, $26, $ab, $5f
db $a8, $ad, $18, $b1, $c7, $6b, $24, $ae
db $cb, $ea, $a8, $41, $97, $fe, $e4, $fd
db $ee, $29, $17, $25, $f5, $30, $5d, $99
db $a0, $47, $f3, $d0, $29, $d9, $fa, $9b
db $6a, $14, $9c, $55, $bb, $a9, $b8, $29
db $35, $de, $5b, $74, $1a, $97, $83, $82
db $af, $32, $3c, $cf, $c0, $3d, $bf, $1e
db $ef, $ab, $01, $20, $61, $ae, $be, $18
db $5b, $b7, $24, $38, $9e, $fa, $cc, $60
db $9d, $1c, $00, $fe, $b7, $d0, $6b, $08
db $b2, $72, $c1, $6d, $a8, $1e, $f3, $3c
db $ae, $1a, $29, $f6, $8e, $1e, $9e, $0f
db $dd, $64, $43, $e7, $b1, $ab, $81, $b4
db $15, $a5, $8d, $12, $e4, $48, $ef, $7e
db $cb, $62, $be, $f9, $ab, $b7, $07, $c6
db $a5, $87, $e1, $f1, $12, $a0, $9e, $07
db $f9, $98, $a6, $2c, $dd, $f7, $48, $65
db $2e, $e5, $49, $7f, $63, $24, $6f, $6e
db $3e, $48, $7b, $14, $4d, $2c, $43, $d2
db $99, $b0, $b3, $18, $d1, $e5, $ef, $d6
db $e9, $98, $fc, $55, $e5, $c9, $81, $37
db $8b, $e5, $d3, $76, $52, $78, $24, $0f
db $33, $0c, $4d, $dc, $8f, $3e, $2d, $32
db $17, $0a, $d3, $5c, $b0, $b3, $29, $4a
db $d4, $65, $43, $8f, $53, $ea, $7d, $bc
db $77, $d3, $ce, $01, $36, $64, $96, $28
db $0f, $5b, $81, $26, $d1, $24, $bb, $e8
db $40, $a5, $bd, $a6, $79, $99, $f6, $25
db $8f, $ea, $88, $0e, $98, $f3, $db, $b3
db $7d, $3c, $b5, $74, $0a, $52, $ab, $4f
db $39, $1e, $08, $8a, $26, $91, $d0, $a7
db $36, $cf, $41, $34, $88, $62, $1b, $7b
db $97, $76, $9e, $ad, $4b, $fa, $3f, $98
db $cf, $49, $9b, $89, $1f, $dd, $b8, $47
db $73, $fe, $b6, $92, $fb, $4f, $e0, $84
db $dd, $1a, $92, $6c, $31, $7d, $84, $c0
db $9b, $81, $c4, $64, $f8, $38, $de, $cc
db $dc, $c0, $b7, $e1, $fc, $d4, $48, $cb
db $8a, $82, $52, $b3, $98, $0d, $c3, $6d
db $b9, $66, $19, $c4, $af, $cf, $50, $ae
db $ff, $34, $75, $c7, $9e, $8b, $dd, $ae
db $5c, $7f, $97, $35, $5d, $5c, $0f, $40
db $53, $5f, $cc, $bb, $7f, $93, $a6, $27
db $3f, $6f, $ff, $a2, $f6, $f9, $5b, $75
db $cf, $55, $43, $77, $ac, $31, $75, $e7
db $bd, $94, $26, $29, $95, $e0, $40, $1c
db $f2, $ac, $ea, $f6, $a0, $1a, $9c, $13
db $e7, $f3, $7c, $be, $ff, $e4, $c6, $f2
db $70, $e5, $a1, $55, $9e, $cd, $1e, $f4
db $7c, $55, $26, $8c, $ac, $9a, $63, $3b
db $af, $f6, $fc, $87, $c4, $07, $2e, $18
db $19, $b6, $d4, $17, $84, $82, $53, $1d
db $fc, $4b, $71, $64, $d6, $e9, $dc, $1f
db $a1, $6c, $f8, $46, $1e, $f8, $92, $c3
db $a8, $cd, $d2, $ff, $fa, $8d, $c9, $4b
db $32, $67, $38, $3a, $b1, $c6, $7d, $40
db $58, $58, $ed, $e1, $8d, $f8, $93, $f2
db $72, $55, $12, $fa, $36, $5c, $62, $b0
db $08, $8d, $3d, $57, $43, $b6, $04, $8a
db $96, $d5, $04, $00, $01, $01, $bd, $82
db $29, $96, $28, $a4, $7f, $8d, $a3, $32
db $8f, $81, $dc, $cf, $6a, $2e, $a5, $55
db $6f, $54, $91, $1c, $32, $7b, $f3, $14
db $08, $0c, $16, $de, $f1, $6f, $38, $c5
db $cb, $c6, $b6, $7b, $f9, $24, $37, $a1
db $91, $99, $8e, $3e, $bb, $da, $1a, $fc
db $83, $f6, $4f, $57, $23, $ab, $e5, $bd
db $40, $3d, $ee, $f8, $ab, $8b, $b4, $72
db $e9, $ad, $a8, $5d, $44, $7c, $b9, $fe
db $9a, $7f, $44, $58, $94, $6b, $0e, $a3
db $01, $1a, $1b, $d9, $ea, $9a, $67, $8b
db $4e, $c8, $48, $bb, $38, $c1, $a9, $77
db $ec, $b2, $54, $b9, $f5, $0a, $04, $1a
db $a7, $a7, $62, $54, $af, $aa, $46, $0d
db $08, $bc, $16, $4c, $e8, $0d, $8e, $2e
db $30, $22, $93, $1d, $c4, $b6, $ec, $55
db $15, $44, $1d, $ab, $5b, $8e, $e5, $af
db $ef, $65, $88, $f7, $00, $06, $34, $5b
db $14, $19, $2e, $4d, $ff, $17, $ea, $a5
db $9c, $58, $65, $12, $f1, $87, $7c, $a8
db $54, $21, $b4, $dd, $5b, $81, $07, $5b
db $5f, $82, $47, $8b, $3f, $76, $3c, $65
db $68, $16, $c1, $73, $b3, $a4, $20, $42
db $c7, $76, $3b, $07, $f0, $96, $3d, $06
db $2f, $95, $73, $5d, $14, $90, $f4, $f9
db $9e, $31, $4a, $3b, $8a, $59, $9b, $7d
db $60, $36, $66, $b3, $40, $76, $7e, $22
db $79, $4d, $64, $1d, $c8, $2b, $c2, $b5
db $d8, $a6, $c9, $d7, $cd, $63, $ff, $8d
db $32, $26, $02, $d7, $4c, $81, $0b, $2c
db $af, $75, $46, $41, $b0, $43, $27, $03
db $45, $43, $39, $92, $ce, $0d, $2d, $be
db $9d, $79, $e7, $b2, $7d, $b4, $a3, $db
db $6b, $66, $4c, $f6, $e9, $38, $2e, $70
db $aa, $5a, $2b, $35, $3a, $f7, $a1, $1b
db $e6, $23, $dc, $5f, $00, $43, $cb, $d2
db $f8, $6f, $76, $82, $04, $18, $4b, $6a
db $ca, $75, $d6, $90, $d0, $74, $f7, $ca
db $40, $bb, $5d, $f8, $03, $c3, $30, $50
db $fb, $50, $ad, $f2, $c7, $4b, $10, $00
db $e9, $97, $b1, $b7, $21, $cd, $7c, $0c
db $f2, $60, $97, $1d, $f2, $b3, $9e, $d7
db $af, $08, $f3, $48, $99, $83, $e0, $00
db $24, $46, $45, $a4, $fb, $fd, $1b, $f0
db $b0, $1e, $0f, $2f, $ca, $7a, $2b, $03
db $5b, $3e, $78, $ad, $04, $95, $d8, $27
db $38, $5b, $ea, $bd, $a2, $a2, $6f, $26
db $26, $65, $a7, $54, $3e, $2e, $3f, $ec
db $7c, $a8, $fc, $30, $d4, $0e, $a3, $75
db $ef, $fc, $35, $89, $b3, $ad, $27, $93
db $71, $85, $8c, $66, $62, $4e, $b3, $e1
db $aa, $ab, $5f, $3f, $ff, $7a, $8d, $5e
db $d7, $45, $15, $56, $cd, $15, $9b, $95
db $57, $2a, $a7, $c4, $3b, $0e, $67, $fa
db $7f, $93, $4a, $66, $fb, $8d, $24, $41
db $3b, $4c, $19, $3d, $fc, $eb, $03, $66
db $29, $45, $21, $f0, $35, $17, $38, $05
db $30, $c4, $e1, $6a, $fa, $bb, $eb, $e1
db $25, $57, $68, $31, $2c, $af, $0f, $47
db $5c, $0e, $91, $77, $5e, $8a, $6e, $41
db $fe, $0c, $60, $78, $72, $8c, $07, $28
db $09, $aa, $43, $7f, $61, $70, $01, $21
db $84, $92, $27, $6d, $53, $56, $b8, $0e
db $ad, $e0, $60, $ee, $6e, $71, $8a, $5f
db $0a, $e2, $2c, $2c, $dc, $37, $e8, $51
db $16, $a3, $a1, $14, $58, $00, $d2, $6a
db $d8, $d5, $b6, $d6, $7d, $74, $f2, $b5
db $5e, $e9, $80, $3e, $b3, $f6, $4e, $ba
db $88, $ef, $8c, $0e, $91, $f1, $df, $35
db $33, $66, $ba, $84, $bc, $50, $fd, $b5
db $0c, $de, $19, $80, $22, $53, $63, $38
db $05, $7d, $2a, $ea, $51, $bc, $3f, $b7
db $d9, $72, $bf, $20, $94, $d6, $d5, $62
db $7c, $a3, $99, $4d, $45, $05, $36, $c6
db $21, $97, $78, $7e, $a8, $e5, $d0, $f6
db $c6, $88, $8a, $a0, $c6, $b1, $8d, $5a
db $28, $4d, $05, $6d, $ec, $b2, $51, $f7
db $03, $a6, $de, $45, $f6, $fd, $2c, $88
db $40, $fb, $17, $f5, $24, $3e, $1a, $23
db $b4, $4b, $4b, $b8, $f7, $8c, $b6, $3b
db $75, $ac, $19, $5d, $34, $ae, $75, $05
db $cc, $d6, $e4, $b9, $77, $69, $31, $c3
db $54, $18, $65, $f3, $6b, $9a, $40, $bf
db $99, $b0, $34, $4d, $5f, $6e, $5e, $fa
db $c9, $d0, $a2, $09, $91, $c9, $41, $b9
db $3a, $8d, $d4, $86, $b8, $a1, $7c, $fa
db $5e, $f8, $f8, $8e, $49, $8f, $60, $b1
db $3a, $3e, $84, $5c, $13, $41, $30, $b7
db $38, $be, $a5, $e1, $68, $89, $f7, $95
db $a3, $0f, $f2, $ae, $a1, $67, $72, $ad
db $55, $16, $27, $9d, $ef, $fb, $c9, $57
db $4f, $10, $5c, $57, $13, $ba, $7c, $18
db $4b, $7e, $7b, $b3, $a6, $7c, $f1, $7f
db $57, $b2, $ec, $ee, $57, $44, $c8, $b7
db $ee, $22, $15, $3f, $44, $85, $28, $ab
db $a0, $35, $43, $58, $2c, $43, $56, $68
db $66, $cb, $ea, $85, $03, $34, $8b, $de
db $4d, $9e, $11, $f6, $ee, $87, $c1, $79
db $33, $0a, $2d, $47, $04, $ad, $cb, $b4
db $7d, $de, $65, $9c, $4e, $1c, $2e, $f4
db $1c, $3d, $18, $e0, $03, $04, $c4, $c7
db $23, $ad, $06, $15, $9a, $ef, $91, $28
db $6d, $76, $39, $f4, $6f, $49, $d0, $32
db $8b, $87, $e1, $b8, $04, $09, $f4, $e1
db $78, $1b, $9f, $d4, $47, $cf, $8f, $53
db $6d, $bc, $c6, $7b, $08, $a2, $9e, $7c
db $59, $06, $0e, $2f, $b2, $b4, $41, $c6
db $64, $ca, $06, $48, $11, $99, $4a, $da
db $12, $55, $29, $b5, $b7, $4a, $7c, $20
db $5b, $e0, $65, $e4, $6f, $69, $b8, $78
db $d0, $0a, $82, $89, $e7, $ee, $9b, $d0
db $ee, $52, $0c, $a7, $9c, $27, $b1, $5e
db $91, $75, $13, $87, $ae, $2d, $8c, $fa
db $9f, $db, $cf, $e5, $cd, $a4, $a9, $2a
db $16, $b7, $99, $8e, $47, $dd, $2c, $db
db $4a, $fe, $57, $a9, $18, $07, $83, $7d
db $a5, $7e, $bc, $c3, $b5, $55, $50, $be
db $40, $e5, $1e, $40, $3f, $25, $28, $0e
db $80, $ab, $a8, $14, $2f, $44, $5d, $f6
db $33, $00, $3a, $c7, $e1, $16, $c4, $c1
db $4c, $98, $5f, $c8, $f7, $c7, $5c, $58
db $f7, $19, $d8, $2f, $9b, $bb, $00, $51
db $3b, $cd, $46, $f3, $bd, $95, $04, $25
db $67, $eb, $bf, $e0, $aa, $29, $f4, $97
db $a9, $3c, $6d, $af, $35, $c2, $1b, $7b
db $43, $45, $99, $bc, $73, $c7, $6e, $79
db $5c, $4d, $c8, $b7, $50, $2e, $1c, $cb
db $3b, $4a, $dc, $02, $a5, $ac, $29, $e8
db $3c, $b8, $03, $34, $be, $34, $9f, $5a
db $e3, $d5, $70, $9c, $fc, $26, $94, $e7
db $a0, $31, $1c, $da, $9a, $30, $36, $26
db $69, $d4, $d9, $e6, $69, $d5, $82, $df
db $ce, $67, $cb, $44, $12, $e1, $1b, $2b
db $af, $5b, $76, $33, $88, $3b, $d5, $6f
db $cf, $00, $ad, $51, $c9, $d9, $70, $7c
db $5c, $23, $9c, $95, $ed, $37, $ce, $25
db $ae, $8b, $52, $b2, $e1, $12, $91, $48
db $97, $1c, $c7, $69, $a9, $09, $1c, $f4
db $fb, $b5, $10, $65, $06, $f0, $91, $2c
db $69, $5a, $13, $75, $7a, $74, $ea, $9f
db $4d, $5c, $cb, $82, $bd, $ff, $a0, $b0
db $cd, $94, $ee, $47, $88, $57, $35, $63
db $8c, $e2, $98, $a8, $b8, $57, $9e, $f4
db $aa, $09, $fe, $39, $88, $91, $71, $62
db $92, $a5, $21, $8b, $60, $68, $20, $13
db $db, $47, $da, $f5, $66, $a8, $01, $ba
db $ff, $15, $1d, $2e, $a3, $b6, $83, $d0
db $6e, $12, $47, $1d, $ef, $98, $36, $90
db $d3, $aa, $5b, $e9, $d7, $f9, $62, $55
db $53, $cf, $e3, $a0, $6b, $c5, $e0, $19
db $0e, $ea, $9b, $a4, $75, $4d, $06, $84
db $87, $c7, $61, $2b, $a2, $ca, $59, $b1
db $d4, $70, $94, $58, $45, $7d, $78, $90
db $47, $58, $0b, $7c, $b8, $5d, $9d, $a5
db $3c, $37, $a6, $3e, $26, $70, $c0, $e4
db $d0, $1d, $2a, $7b, $b5, $93, $b6, $32
db $a2, $48, $a5, $8c, $66, $05, $6d, $4f
db $31, $77, $9d, $1d, $bb, $4d, $9f, $86
db $c1, $4c, $28, $cd, $1e, $4c, $1f, $04
db $55, $e2, $d0, $6a, $9a, $e1, $38, $00
db $ae, $73, $0b, $4e, $e6, $53, $d9, $ee
db $40, $2f, $19, $80, $56, $98, $5b, $7e
db $61, $ed, $28, $bc, $22, $85, $a2, $b9
db $cf, $95, $fc, $d3, $67, $f3, $83, $2e
db $50, $5b, $c8, $e6, $5d, $08, $f4, $e2
db $64, $b5, $f9, $3f, $35, $51, $79, $4e
db $65, $6c, $04, $59, $c4, $2b, $39, $42
db $2b, $d3, $ae, $1e, $74, $ce, $72, $ae
db $4a, $a9, $df, $9e, $fc, $17, $b4, $cc
db $38, $6a, $72, $ed, $e0, $af, $84, $68
db $8e, $9e, $0e, $a1, $e4, $c0, $e2, $85
db $d0, $50, $35, $0a, $10, $62, $d1, $d7
db $5e, $8e, $6b, $a7, $30, $d5, $9c, $ab
db $05, $f4, $6e, $50, $ef, $bc, $8d, $d9
db $92, $df, $5c, $19, $16, $06, $5a, $f2
db $53, $ea, $e3, $de, $c3, $24, $6e, $a6
db $9f, $43, $9e, $e8, $f3, $dd, $b7, $5e
db $21, $c2, $ea, $59, $8e, $f1, $c7, $29
db $b7, $0b, $c8, $91, $90, $a9, $9d, $35
db $14, $95, $8d, $2c, $fb, $22, $36, $e9
db $31, $71, $de, $4f, $7e, $2e, $07, $e2
db $cb, $30, $63, $e1, $16, $2d, $f4, $b0
db $a0, $81, $26, $bd, $71, $ff, $ab, $2e
db $90, $ff, $45, $2e, $5f, $d5, $61, $7a
db $39, $19, $96, $b3, $d4, $3e, $6c, $5c
db $9d, $45, $97, $c4, $66, $43, $88, $55
db $17, $46, $a8, $2a, $29, $41, $4c, $69
db $72, $6a, $c8, $61, $1d, $8e, $4c, $32
db $f2, $81, $c5, $b3, $9e, $40, $00, $6e
db $bf, $47, $f4, $92, $38, $4d, $2b, $f2
db $9a, $ba, $d3, $f6, $dc, $06, $f7, $1e
db $93, $dd, $d9, $21, $81, $36, $5d, $d4
db $f8, $0b, $7b, $43, $59, $04, $88, $f3
db $a3, $49, $54, $ca, $5e, $a8, $4d, $f3
db $37, $63, $01, $02, $86, $38, $c0, $b4
db $5c, $92, $aa, $9b, $ac, $e5, $31, $60
db $de, $b4, $2f, $89, $c6, $87, $9d, $57
db $9d, $89, $71, $ba, $86, $ac, $00, $3a
db $ac, $92, $a4, $7b, $b3, $32, $28, $d3
db $9c, $83, $fb, $4d, $2c, $7d, $9c, $19
db $40, $a0, $02, $0f, $e9, $ab, $15, $cb
db $5d, $70, $df, $31, $04, $f7, $af, $9c
db $9b, $aa, $85, $3c, $f1, $75, $4f, $4a
db $00, $5e, $ec, $29, $57, $e7, $76, $db
db $9e, $ad, $f4, $78, $f6, $65, $43, $9f
db $65, $85, $4e, $37, $77, $69, $b2, $04
db $fc, $ef, $0a, $24, $b7, $24, $1c, $d1
db $eb, $75, $5b, $e2, $de, $30, $b2, $d3
db $d1, $74, $c6, $1a, $07, $e0, $ea, $75
db $75, $0a, $94, $ec, $b5, $e5, $6d, $e8
db $c0, $95, $03, $71, $c2, $22, $c0, $2f
db $6d, $05, $a1, $12, $9f, $e3, $a2, $2c
db $a2, $df, $9b, $13, $d9, $74, $bd, $56
db $94, $85, $f3, $10, $9d, $6b, $c2, $98
db $8f, $8d, $39, $63, $34, $08, $b8, $db
db $d7, $2b, $bd, $7a, $ae, $55, $72, $7d
db $b9, $50, $f6, $e1, $27, $3c, $a9, $b4
db $d4, $d6, $cb, $42, $8a, $59, $b2, $14
db $94, $2c, $3e, $a5, $2c, $43, $1a, $d4
db $23, $d6, $e3, $6f, $50, $55, $c1, $bd
db $cd, $d7, $bc, $0e, $88, $06, $ab, $27
db $05, $77, $33, $d9, $78, $eb, $ea, $35
db $04, $56, $f0, $b5, $97, $12, $b1, $eb
db $8c, $19, $a4, $5e, $95, $94, $c7, $54
db $39, $3d, $ca, $6a, $52, $1e, $c2, $7e
db $20, $e9, $ba, $be, $38, $22, $2c, $3e
db $28, $70, $31, $9c, $be, $0d, $cc, $df
db $7d, $9d, $4a, $ba, $01, $79, $a1, $48
db $ed, $fe, $37, $24, $28, $ac, $41, $f3
db $aa, $6c, $c8, $1a, $d0, $31, $6a, $4e
db $27, $de, $eb, $11, $5f, $4b, $28, $6e
db $80, $1e, $6c, $4c, $e0, $3c, $ae, $24
db $81, $a5, $72, $d4, $ea, $28, $dc, $4a
db $13, $bf, $64, $55, $9c, $53, $ac, $45
db $f9, $09, $8f, $5c, $88, $b7, $ac, $25
db $a8, $05, $9e, $18, $e3, $8a, $a2, $b6
db $75, $88, $fb, $38, $39, $f7, $4b, $f0
db $4a, $61, $80, $3b, $29, $30, $cd, $9c
db $41, $9d, $dd, $a1, $da, $9f, $7f, $f2
db $19, $90, $62, $e9, $00, $fc, $0f, $1d
db $e5, $5f, $44, $9f, $b3, $03, $f5, $fe
db $8c, $17, $2d, $c7, $d7, $63, $07, $33
db $8d, $64, $45, $4a, $14, $88, $84, $06
db $96, $e0, $71, $63, $aa, $14, $78, $2b
db $24, $16, $07, $87, $65, $f2, $3b, $7f
db $a8, $95, $19, $44, $16, $43, $1a, $f7
db $af, $38, $0d, $7e, $1e, $65, $86, $64
db $85, $0c, $81, $53, $68, $39, $0f, $f8
db $93, $92, $84, $c9, $d2, $15, $3b, $e8
db $f6, $b5, $4e, $0d, $c5, $07, $af, $ff
db $b9, $62, $ce, $8e, $0e, $6c, $91, $a0
db $42, $c8, $01, $c7, $33, $e1, $7c, $09
db $af, $07, $df, $c6, $45, $1a, $59, $f0
db $6c, $bc, $5c, $a5, $a4, $b1, $7a, $cd
db $cc, $3b, $ae, $e3, $70, $6f, $e6, $8c
db $a2, $52, $92, $4b, $44, $24, $65, $43
db $61, $fa, $67, $a6, $c1, $76, $06, $5f
db $81, $0b, $91, $32, $02, $e3, $bb, $ba
db $7a, $62, $dc, $75, $26, $c9, $12, $89
db $4e, $9a, $d2, $4f, $27, $8d, $a1, $f6
db $0c, $34, $36, $30, $26, $61, $6c, $ad
db $37, $db, $9a, $31, $7f, $b3, $39, $ec
db $b5, $0a, $b4, $ea, $d0, $41, $8e, $ee
db $44, $0d, $32, $63, $03, $55, $cc, $49
db $f2, $87, $fe, $8d, $3d, $25, $59, $1d
db $71, $da, $15, $17, $de, $bd, $f0, $ed
db $2d, $d2, $cf, $03, $ab, $cb, $9f, $61
db $fb, $e3, $43, $b8, $6d, $f4, $c9, $94
db $72, $3f, $e5, $dd, $2d, $30, $e5, $f2
db $9f, $6f, $fa, $f3, $12, $eb, $d5, $a8
db $5d, $ac, $bb, $5e, $ac, $c2, $b3, $fc
db $14, $93, $08, $92, $49, $ae, $88, $c4
db $63, $01, $7c, $64, $54, $4a, $6d, $f0
db $ae, $56, $32, $cb, $23, $5f, $67, $99
db $20, $46, $7f, $4b, $9f, $89, $c7, $1b
db $ba, $c5, $2a, $fc, $86, $71, $70, $12
db $a0, $97, $1e, $c7, $95, $33, $e9, $f4
db $7a, $b7, $b1, $5d, $9c, $46, $69, $81
db $ff, $16, $f8, $82, $c6, $d2, $4a, $96
db $52, $96, $fe, $b3, $d6, $14, $7d, $2b
db $43, $d8, $8c, $f8, $e5, $ae, $41, $14
db $d2, $9b, $80, $40, $64, $04, $16, $48
db $56, $4b, $31, $f4, $9b, $ec, $db, $98
db $c9, $35, $8a, $71, $d1, $8a, $a7, $e3
db $98, $df, $0f, $ab, $98, $c6, $ce, $3c
db $a6, $66, $44, $84, $37, $b7, $ee, $74
db $6a, $fa, $8d, $12, $fa, $d7, $ad, $dc
db $69, $7a, $75, $7e, $4e, $97, $c3, $ef
db $eb, $73, $d1, $e1, $be, $b0, $97, $62
db $a9, $37, $ef, $c9, $a4, $6e, $4c, $50
db $51, $f6, $17, $1e, $62, $2b, $15, $b4
* = D4BASE
db $9d, $f5, $fd, $86, $46, $05, $0f, $95
db $7d, $ec, $a6, $bd, $50, $4f, $d9, $c4
db $13, $b1, $91, $e4, $e8, $03, $11, $c7
db $af, $83, $99, $96, $5d, $63, $05, $8f
db $e7, $42, $1d, $62, $6c, $b2, $91, $77
db $c9, $a6, $76, $c2, $9b, $2f, $da, $a3
db $32, $63, $76, $eb, $9d, $b8, $35, $1f
db $d2, $0c, $bf, $bd, $87, $5a, $ab, $75
db $d0, $84, $17, $27, $d1, $89, $e7, $96
db $ac, $e0, $f8, $59, $42, $7c, $84, $97
db $47, $d8, $1d, $f1, $40, $d6, $2f, $34
db $53, $7d, $52, $76, $5c, $7f, $f1, $57
db $6f, $79, $3a, $89, $8a, $30, $87, $e7
db $15, $13, $82, $c2, $e1, $1d, $f2, $e1
db $be, $ad, $02, $5b, $67, $a5, $53, $0a
db $fd, $c6, $48, $e9, $82, $dd, $66, $dd
db $63, $ae, $0e, $58, $36, $6c, $c2, $a2
db $94, $ae, $0e, $32, $ce, $d6, $07, $2a
db $d4, $c0, $cd, $04, $fd, $14, $75, $7f
db $59, $f0, $62, $a8, $b9, $12, $1e, $32
db $97, $b2, $8e, $7d, $c7, $35, $4e, $e3
db $ae, $5a, $d1, $e0, $ca, $09, $ab, $cc
db $8e, $a2, $71, $1b, $d0, $1a, $68, $24
db $ee, $9b, $e8, $fe, $72, $52, $f6, $a9
db $a3, $e9, $6b, $d5, $62, $07, $47, $92
db $12, $a1, $dd, $18, $4c, $15, $58, $e3
db $37, $a9, $a2, $eb, $b7, $33, $a6, $bb
db $28, $b4, $26, $40, $23, $36, $d2, $5b
db $71, $67, $66, $68, $fe, $ad, $1f, $5b
db $16, $f1, $f9, $6a, $64, $12, $e1, $c9
db $af, $fc, $e7, $81, $43, $6c, $3f, $91
db $a7, $8a, $b1, $d4, $1d, $c0, $7e, $81
db $ac, $43, $2c, $e1, $b4, $fb, $8e, $7e
db $ce, $3a, $b0, $b6, $e2, $25, $8a, $6c
db $a4, $31, $fd, $f8, $56, $3b, $73, $c1
db $5a, $ad, $f9, $65, $fc, $5d, $03, $f1
db $9a, $29, $db, $c5, $0f, $78, $7e, $3f
db $36, $b5, $66, $14, $1d, $eb, $a5, $c2
db $d4, $9e, $78, $0f, $67, $07, $15, $d7
db $d7, $a7, $81, $9e, $b5, $bf, $45, $c2
db $73, $ee, $ad, $c8, $21, $ab, $28, $5d
db $7e, $74, $2f, $a2, $b3, $53, $8b, $83
db $2f, $d3, $7d, $bc, $68, $0b, $aa, $f7
db $4d, $80, $35, $58, $50, $a9, $59, $93
db $94, $06, $ba, $21, $c8, $15, $32, $da
db $1f, $e2, $62, $a8, $0e, $1d, $30, $e9
db $ed, $b5, $7f, $72, $ad, $37, $c2, $ea
db $4e, $0b, $a7, $52, $31, $82, $5c, $6f
db $70, $b4, $66, $51, $89, $cf, $bb, $6e
db $21, $70, $15, $27, $52, $38, $07, $a8
db $bf, $9f, $1a, $30, $d9, $c0, $41, $d2
db $a3, $9f, $c5, $d9, $9d, $e1, $75, $b0
db $10, $90, $ea, $fb, $72, $3a, $46, $2f
db $04, $c0, $fa, $93, $31, $02, $d9, $3a
db $b4, $15, $81, $26, $18, $02, $a9, $b1
db $69, $30, $fd, $2e, $2d, $af, $72, $88
db $86, $4f, $fe, $ec, $4e, $d7, $6c, $94
db $ed, $44, $82, $5d, $07, $12, $b1, $96
db $99, $9d, $35, $06, $ce, $9b, $fc, $32
db $8e, $4c, $fb, $86, $7b, $4e, $bb, $aa
db $32, $91, $bd, $48, $56, $e5, $eb, $e0
db $87, $e3, $19, $06, $67, $6e, $67, $48
db $41, $e6, $3c, $65, $c3, $36, $1c, $a6
db $13, $f3, $6a, $ef, $34, $6c, $0a, $ac
db $dd, $88, $6a, $53, $9c, $f3, $15, $21
db $44, $7c, $d7, $31, $57, $05, $6c, $d2
db $53, $3e, $53, $20, $08, $e8, $90, $29
db $d6, $9e, $92, $cc, $80, $a6, $cd, $d1
db $02, $14, $f4, $a3, $c0, $c3, $34, $16
db $92, $8b, $7e, $f2, $8b, $d7, $84, $ab
db $fc, $d0, $a5, $de, $ae, $dc, $e5, $34
db $59, $7e, $f1, $13, $65, $42, $46, $41
db $5d, $57, $0f, $4e, $1f, $e9, $e6, $db
db $67, $af, $e0, $94, $8b, $6a, $4a, $fd
db $60, $6b, $1d, $68, $93, $4e, $28, $8c
db $6c, $6e, $b3, $d8, $d7, $b9, $7b, $b8
db $e9, $3c, $ed, $dd, $03, $8d, $08, $a2
db $59, $3c, $31, $f7, $b4, $4b, $15, $4a
db $49, $65, $6e, $c6, $21, $e0, $a7, $a5
db $c5, $be, $ac, $27, $dd, $fc, $c1, $74
db $f6, $12, $1b, $dd, $d1, $d9, $e2, $46
db $92, $7a, $43, $4b, $75, $3f, $2c, $84
db $ad, $fc, $9b, $ab, $14, $0e, $78, $92
db $c2, $35, $16, $c6, $5f, $b9, $23, $21
db $83, $20, $23, $3d, $57, $5c, $4b, $f4
db $fa, $a7, $15, $d0, $7c, $05, $68, $34
db $5a, $d7, $16, $4e, $82, $d1, $8a, $fa
db $b2, $79, $bd, $97, $18, $5b, $d6, $eb
db $de, $0e, $9e, $ca, $9c, $1c, $75, $5a
db $55, $8e, $02, $69, $25, $a6, $4e, $c5
db $d1, $15, $39, $c3, $aa, $2c, $c6, $d8
db $f3, $d0, $a1, $fc, $2f, $27, $74, $75
db $2e, $9f, $ec, $85, $8f, $cc, $6f, $86
db $59, $ac, $68, $f1, $b6, $0b, $5c, $fd
db $86, $20, $01, $84, $a4, $aa, $a7, $d7
db $ad, $17, $2b, $94, $ec, $33, $5d, $14
db $cc, $ea, $e9, $a3, $1c, $e5, $5d, $69
db $88, $63, $60, $91, $76, $39, $68, $42
db $d4, $1e, $c1, $10, $d2, $15, $2b, $5f
db $e2, $78, $80, $1c, $98, $26, $73, $f2
db $b8, $03, $e0, $51, $24, $34, $53, $18
db $08, $69, $8c, $87, $06, $ae, $41, $ab
db $20, $ee, $37, $05, $f2, $ea, $48, $57
db $ca, $6c, $fd, $db, $d6, $17, $ab, $25
db $e2, $5b, $aa, $d1, $fa, $ca, $72, $7f
db $e2, $0f, $e0, $06, $3a, $5a, $16, $e3
db $e7, $e0, $43, $51, $80, $51, $38, $02
db $98, $98, $12, $e9, $18, $c1, $89, $2b
db $6a, $b0, $fa, $13, $68, $58, $30, $8f
db $dc, $62, $34, $68, $55, $0d, $45, $55
db $2a, $da, $b4, $79, $d9, $fa, $d3, $57
db $5a, $25, $03, $89, $3b, $64, $0d, $98
db $2e, $86, $ee, $fb, $40, $a8, $39, $c1
db $09, $48, $f8, $64, $7a, $ad, $8c, $9a
db $7c, $ef, $aa, $ad, $cb, $c3, $c1, $77
db $aa, $f8, $8d, $9f, $ab, $42, $e0, $d1
db $de, $63, $25, $b9, $5c, $c9, $63, $b5
db $52, $82, $43, $7b, $7a, $d5, $31, $3b
db $57, $8b, $9c, $19, $c4, $8d, $88, $82
db $5f, $75, $78, $42, $3d, $a1, $f8, $8f
db $f9, $54, $2d, $71, $28, $3e, $7d, $e9
db $d5, $55, $c1, $17, $cb, $07, $c0, $42
db $61, $e3, $de, $f8, $ca, $54, $c3, $8a
db $8a, $4c, $cf, $2f, $a1, $c2, $a6, $8c
db $34, $06, $83, $03, $86, $e9, $70, $68
db $35, $27, $fd, $93, $fe, $4f, $ed, $4b
db $b5, $12, $43, $86, $f6, $b9, $a8, $4d
db $fc, $01, $43, $61, $61, $7e, $e8, $d2
db $fe, $f9, $8d, $d1, $7c, $99, $5b, $26
db $d7, $72, $92, $84, $0a, $e0, $80, $4f
db $d9, $f6, $27, $ca, $61, $4f, $03, $1a
db $68, $85, $20, $83, $59, $c6, $f6, $85
db $85, $34, $a6, $62, $2b, $58, $ca, $f0
db $40, $29, $5a, $4d, $74, $6d, $34, $54
db $7c, $0f, $cd, $28, $ba, $be, $f1, $93
db $fc, $a2, $6a, $84, $97, $33, $89, $06
db $8a, $ad, $d8, $62, $6b, $a2, $0c, $cc
db $40, $5f, $b0, $00, $85, $a9, $d0, $6c
db $70, $73, $02, $9d, $9f, $54, $98, $33
db $37, $3e, $bf, $21, $2c, $bd, $e6, $e9
db $12, $10, $b4, $41, $f0, $4a, $5d, $fe
db $48, $37, $ab, $97, $57, $55, $22, $ac
db $1b, $34, $a6, $85, $15, $87, $a6, $45
db $00, $e6, $0d, $92, $96, $72, $40, $00
db $13, $75, $e8, $c0, $f4, $79, $44, $1c
db $3e, $f9, $aa, $f4, $46, $1a, $83, $f5
db $c2, $46, $00, $a2, $3c, $f6, $76, $ed
db $5c, $10, $40, $d7, $a6, $79, $2f, $14
db $2d, $a7, $2d, $d5, $5d, $38, $15, $11
db $53, $52, $06, $27, $7b, $de, $e3, $f8
db $f1, $24, $75, $f1, $8d, $07, $02, $ea
db $cc, $63, $52, $e2, $49, $24, $8b, $c1
db $a3, $82, $90, $29, $e8, $ba, $a2, $35
db $e6, $1d, $9c, $35, $bf, $61, $3b, $ba
db $82, $bd, $97, $ce, $cd, $3a, $99, $c7
db $19, $18, $19, $65, $af, $15, $f1, $02
db $06, $6b, $a9, $f8, $2c, $5f, $1d, $a2
db $97, $61, $1d, $3c, $28, $6e, $ca, $7d
db $b4, $f4, $6b, $90, $01, $56, $e7, $27
db $84, $d5, $2b, $c4, $f3, $b2, $f1, $2e
db $a7, $51, $53, $6a, $cb, $5b, $b2, $a8
db $19, $00, $b5, $85, $2e, $1b, $5a, $65
db $f6, $55, $a1, $34, $04, $54, $1b, $47
db $78, $74, $1c, $3a, $98, $10, $a7, $35
db $19, $72, $88, $aa, $86, $aa, $6c, $62
db $86, $36, $3f, $11, $51, $25, $10, $0a
db $89, $ae, $6c, $a5, $8a, $39, $46, $1b
db $76, $18, $19, $19, $44, $68, $7f, $94
db $88, $95, $6b, $9a, $d9, $d5, $4b, $10
db $57, $18, $e9, $d6, $a6, $fa, $12, $65
db $d7, $26, $69, $a0, $f7, $8f, $13, $f4
db $7b, $8e, $97, $90, $c9, $fb, $f2, $22
db $21, $c9, $29, $b3, $51, $15, $fd, $13
db $fb, $b1, $d5, $07, $84, $b5, $35, $35
db $99, $37, $c3, $1e, $f6, $13, $4f, $04
db $17, $2b, $22, $90, $fe, $1b, $b0, $ce
db $53, $75, $03, $74, $36, $ff, $98, $97
db $1d, $50, $22, $5e, $c3, $ee, $61, $83
db $88, $c9, $c0, $49, $80, $85, $d2, $b8
db $cb, $a6, $14, $7d, $c7, $9f, $71, $26
db $a3, $e4, $b4, $a8, $26, $29, $76, $3b
db $52, $30, $10, $5b, $86, $3f, $87, $16
db $a8, $6b, $76, $06, $bf, $78, $1d, $ee
db $04, $ce, $d4, $a1, $48, $91, $67, $69
db $03, $35, $06, $4e, $55, $d5, $1d, $65
db $30, $40, $a7, $80, $7e, $df, $b6, $f9
db $7a, $83, $03, $f9, $1b, $fe, $3d, $a6
db $00, $ee, $74, $41, $06, $e2, $85, $62
db $bc, $56, $35, $c5, $e0, $5a, $1d, $01
db $58, $6a, $df, $bf, $6d, $67, $9a, $6a
db $0d, $71, $0d, $94, $72, $39, $8d, $4e
db $40, $ff, $f7, $05, $73, $35, $4a, $81
db $e3, $fb, $01, $9c, $e9, $ff, $6e, $da
db $47, $3d, $6a, $d6, $f4, $cb, $12, $d3
db $7b, $ae, $71, $b9, $27, $c9, $14, $c6
db $8c, $0f, $72, $74, $87, $2c, $15, $ce
db $4b, $e2, $7a, $d0, $2c, $b2, $c1, $85
db $22, $1e, $36, $26, $36, $9b, $a2, $b2
db $1f, $b6, $c0, $18, $f5, $90, $9d, $ae
db $52, $50, $54, $ae, $6a, $86, $b9, $8e
db $5a, $0f, $29, $67, $01, $7c, $72, $42
db $d2, $19, $dc, $4c, $42, $d5, $9d, $1b
db $63, $a1, $13, $4a, $77, $e8, $35, $95
db $d2, $cd, $89, $e7, $79, $a1, $20, $b4
db $38, $a1, $c0, $f6, $d3, $78, $70, $18
db $8a, $f0, $7f, $13, $13, $d8, $a2, $44
db $f0, $5b, $ab, $56, $8d, $ec, $6f, $02
db $9b, $c4, $b6, $af, $f6, $c6, $09, $1d
db $d7, $8e, $7d, $ea, $f0, $b3, $77, $28
db $5f, $c9, $55, $61, $bf, $44, $4c, $29
db $c9, $dd, $9e, $57, $91, $aa, $06, $07
db $4b, $bc, $17, $d3, $68, $92, $04, $2b
db $b5, $0c, $60, $62, $52, $6d, $c3, $58
db $fd, $10, $3e, $13, $8f, $4f, $21, $d9
db $ff, $4e, $77, $3c, $d9, $8c, $f7, $e2
db $45, $64, $1f, $b8, $9b, $de, $da, $3f
db $63, $41, $20, $b7, $bd, $ae, $5c, $b3
db $46, $7a, $76, $92, $89, $73, $82, $21
db $3b, $20, $9d, $8a, $9c, $c3, $63, $5c
db $c9, $f8, $fb, $6a, $d5, $60, $29, $19
db $60, $7c, $ca, $36, $42, $9e, $2e, $de
db $3c, $74, $13, $c3, $94, $f4, $1c, $b0
db $5c, $25, $fd, $e5, $24, $9c, $3d, $60
db $d1, $1c, $a5, $53, $30, $3f, $7d, $7e
db $28, $4d, $58, $93, $f9, $d7, $7b, $91
db $d7, $d8, $5b, $ef, $c4, $1e, $7b, $57
db $bf, $02, $63, $ed, $54, $b7, $d5, $74
db $a3, $05, $04, $e5, $a5, $e7, $d7, $3b
db $03, $6a, $3b, $35, $88, $70, $b5, $3c
db $a6, $40, $c7, $8c, $d8, $1f, $58, $c8
db $13, $e1, $11, $b1, $df, $85, $76, $a2
db $96, $ba, $58, $84, $80, $0e, $54, $19
db $9c, $df, $79, $2d, $20, $55, $50, $ab
db $28, $18, $91, $70, $67, $b8, $d5, $f8
db $b1, $ed, $93, $a7, $b4, $f5, $33, $0d
db $0d, $2a, $a7, $56, $50, $11, $ce, $95
db $9e, $cf, $f2, $a1, $97, $a6, $05, $4c
db $a2, $09, $ad, $da, $33, $fb, $d5, $f1
db $00, $95, $bf, $7c, $02, $ea, $a4, $80
db $13, $72, $b8, $be, $8f, $ee, $6e, $29
db $5f, $78, $90, $5b, $ac, $81, $e5, $ce
db $fd, $16, $9b, $64, $19, $e3, $c1, $dc
db $a7, $4b, $23, $12, $3c, $be, $06, $d2
db $e2, $10, $ca, $28, $00, $13, $25, $e9
db $87, $b4, $40, $3b, $2e, $cc, $a2, $ff
db $20, $a6, $16, $a0, $b2, $7f, $40, $6e
db $a9, $2e, $a3, $0b, $25, $d9, $65, $8d
db $7b, $35, $05, $5a, $6b, $78, $b0, $e9
db $6b, $7e, $94, $e1, $e5, $1b, $4f, $0a
db $8b, $ef, $7b, $6b, $8d, $f5, $58, $dd
db $fc, $c2, $48, $b7, $ca, $5d, $cf, $25
db $3e, $81, $bd, $59, $c4, $e7, $c6, $91
db $fd, $9f, $ab, $d1, $0e, $83, $14, $2e
db $ba, $c2, $4d, $07, $1c, $ce, $7a, $9c
db $07, $2c, $61, $50, $89, $ba, $bf, $8d
db $0b, $ad, $84, $10, $25, $61, $35, $f2
db $2c, $d1, $32, $ff, $3f, $c6, $1a, $7d
db $6e, $80, $6b, $5a, $d3, $e1, $70, $82
db $05, $e4, $f8, $34, $3f, $a8, $28, $98
db $ec, $a7, $d6, $8f, $d4, $21, $c0, $c8
db $44, $27, $4f, $42, $b6, $27, $7f, $6b
db $b3, $69, $6d, $9b, $8d, $5d, $88, $a5
db $c5, $5c, $70, $66, $a9, $f5, $a5, $3c
db $74, $ff, $3b, $12, $ce, $33, $20, $10
db $7c, $3b, $5e, $50, $87, $02, $63, $58
db $7a, $c6, $5e, $45, $c7, $75, $ce, $76
db $d2, $d3, $31, $e9, $42, $3d, $16, $45
db $29, $f7, $ff, $6d, $59, $b9, $1e, $44
db $a8, $1c, $da, $a6, $86, $f3, $aa, $d7
db $32, $cd, $59, $b6, $2d, $b3, $40, $fa
db $34, $c7, $cb, $4b, $9a, $2a, $6e, $a6
db $23, $cc, $7a, $11, $e0, $fa, $fe, $6e
db $55, $d4, $3b, $7f, $c0, $2b, $ee, $ad
db $45, $31, $72, $22, $43, $5c, $32, $80
db $6e, $fe, $96, $fd, $9f, $6e, $56, $b7
db $40, $73, $f2, $4c, $c7, $7b, $e2, $be
db $f5, $b6, $2d, $ed, $ab, $a6, $8c, $fc
db $2b, $f9, $ca, $ba, $45, $6f, $6d, $a9
db $4e, $75, $8b, $ac, $a9, $e8, $2c, $8a
db $02, $91, $9a, $35, $fe, $74, $08, $80
db $04, $32, $ea, $71, $ce, $86, $81, $d3
db $be, $40, $e2, $05, $fe, $bd, $e4, $52
db $9f, $4c, $4f, $fc, $c2, $a0, $ed, $e7
db $41, $ad, $b9, $10, $4e, $56, $ff, $88
db $34, $9d, $6b, $c1, $54, $f2, $a0, $e1
db $28, $e3, $0c, $47, $2a, $8f, $e9, $eb
db $24, $cb, $aa, $b3, $66, $37, $7e, $f6
db $32, $3c, $77, $61, $f4, $44, $af, $33
db $59, $5f, $84, $3b, $4d, $97, $a8, $8a
db $9a, $5f, $6a, $f6, $17, $8f, $59, $96
db $a0, $ba, $77, $9c, $04, $44, $92, $14
db $73, $c9, $fe, $80, $6a, $12, $99, $62
db $59, $e7, $ad, $77, $3c, $71, $28, $9a
db $e0, $01, $5e, $37, $b5, $26, $05, $db
db $be, $90, $4f, $0f, $64, $9b, $39, $b6
db $1b, $ad, $dd, $dd, $dd, $54, $2a, $cc
db $aa, $43, $b2, $39, $5b, $02, $21, $fc
db $de, $9c, $75, $20, $cc, $e9, $f8, $a1
db $15, $7f, $b7, $1c, $3b, $e7, $bc, $de
db $4f, $84, $58, $93, $69, $e3, $4c, $d9
db $af, $c2, $3c, $ff, $16, $ad, $7c, $51
db $de, $72, $f2, $1b, $55, $3e, $3e, $64
db $6a, $2c, $0a, $56, $90, $64, $79, $cc
db $5d, $29, $cf, $ea, $fd, $0d, $84, $a2
db $8f, $5a, $8e, $6d, $a7, $4f, $30, $c1
db $fa, $ea, $82, $6b, $04, $56, $b0, $ea
db $86, $c5, $82, $11, $d9, $46, $d5, $11
db $7a, $4c, $82, $49, $32, $85, $36, $9c
db $f2, $35, $93, $78, $b2, $ee, $62, $53
db $b6, $7a, $50, $27, $f1, $ce, $c9, $e7
db $f7, $8c, $bf, $d3, $aa, $ad, $3b, $fc
db $db, $04, $02, $9f, $20, $e3, $c9, $9e
db $c7, $5e, $47, $65, $3e, $f8, $42, $18
db $cb, $a2, $d2, $34, $a9, $c0, $5f, $8d
db $dc, $26, $bb, $c5, $96, $93, $72, $2e
db $04, $0c, $e7, $0e, $0a, $c1, $ad, $51
db $64, $27, $a2, $ad, $d0, $dc, $4e, $53
db $6a, $71, $bd, $60, $1b, $31, $7b, $9c
db $6c, $d6, $99, $b4, $0c, $8a, $37, $ae
db $32, $38, $30, $10, $80, $43, $25, $68
db $60, $e4, $f8, $f5, $d0, $58, $39, $4d
db $7c, $25, $8b, $b9, $bd, $bc, $c3, $c7
db $70, $14, $e8, $49, $09, $8d, $50, $6f
db $52, $05, $ff, $b4, $57, $51, $9d, $b8
db $e9, $4d, $28, $63, $91, $3c, $77, $d0
db $ef, $69, $c5, $ef, $4c, $74, $50, $c5
db $6c, $d4, $6e, $83, $70, $c1, $c8, $97
db $2f, $60, $c9, $0a, $45, $e5, $e8, $c6
db $df, $82, $11, $b3, $85, $6f, $42, $e7
db $46, $b8, $07, $d2, $6f, $c9, $9e, $43
db $79, $e7, $21, $a0, $2c, $67, $53, $a0
db $42, $83, $d1, $4e, $2b, $3f, $e7, $4c
db $6a, $cd, $f5, $2f, $ab, $84, $c1, $9b
db $81, $9f, $d4, $d0, $30, $a1, $3e, $08
db $5a, $42, $44, $fa, $ec, $6a, $d9, $26
db $60, $e6, $ae, $4e, $38, $a0, $35, $4d
db $2b, $eb, $77, $4b, $67, $1e, $06, $6c
db $f2, $98, $5e, $b4, $f6, $09, $1b, $48
db $94, $19, $56, $c7, $7c, $f1, $b6, $14
db $b6, $ba, $8b, $b5, $9d, $fe, $01, $25
db $d9, $ca, $10, $6c, $71, $03, $65, $50
db $4e, $2c, $11, $7c, $23, $97, $7c, $ae
db $e1, $12, $5d, $02, $27, $2c, $46, $25
db $1e, $2f, $1b, $80, $88, $47, $aa, $92
db $ac, $fb, $7d, $d6, $b0, $55, $7e, $4e
db $bd, $ad, $9e, $f3, $1f, $62, $6b, $b1
db $6f, $c8, $b6, $f4, $02, $8e, $15, $e1
db $06, $73, $d7, $d7, $41, $da, $b3, $2a
db $39, $10, $4d, $ff, $d7, $c5, $02, $ab
db $e3, $fe, $68, $87, $ad, $08, $ff, $fa
db $a0, $ac, $db, $f8, $91, $33, $cd, $91
db $60, $f8, $a6, $c3, $7b, $39, $b4, $2a
db $f4, $c2, $f2, $3f, $76, $8d, $48, $26
db $40, $df, $3d, $30, $2a, $62, $c9, $e9
db $ce, $f7, $f7, $d9, $70, $d9, $33, $ed
db $97, $3c, $26, $b1, $a4, $73, $c2, $d0
db $29, $f8, $a0, $a5, $4c, $fc, $ed, $6e
db $31, $d8, $14, $ba, $99, $c9, $4b, $60
db $5d, $64, $51, $c2, $7f, $cc, $41, $a1
db $0a, $9e, $be, $ef, $5b, $c8, $11, $8d
db $68, $48, $81, $5f, $96, $41, $39, $27
db $23, $62, $b1, $3f, $72, $69, $aa, $9d
db $5e, $df, $47, $1c, $2d, $26, $c6, $0f
db $f0, $84, $5d, $bc, $3d, $58, $ff, $6c
db $81, $67, $7f, $bf, $5f, $0e, $22, $bc
db $09, $1a, $0e, $8e, $19, $46, $9b, $81
db $b4, $75, $f3, $35, $97, $e1, $38, $f3
db $21, $31, $51, $19, $77, $a2, $70, $cc
db $48, $03, $fb, $43, $19, $50, $c8, $a5
db $69, $9f, $65, $4c, $f0, $61, $ea, $eb
db $bb, $a6, $a5, $c2, $14, $19, $20, $09
db $3a, $24, $d9, $f0, $71, $81, $98, $fb
db $c9, $7b, $dd, $4c, $c7, $90, $78, $b6
db $80, $21, $8b, $2f, $e8, $98, $a9, $54
db $f6, $ce, $a5, $97, $7e, $76, $64, $30
db $bb, $74, $23, $ab, $7c, $e4, $6d, $6d
db $cb, $e8, $45, $2c, $70, $98, $f3, $07
db $62, $71, $67, $a1, $69, $ea, $23, $d3
db $21, $c7, $9b, $fb, $3c, $62, $af, $0c
db $80, $ed, $20, $8f, $48, $94, $a8, $3c
db $31, $3c, $6c, $9d, $43, $42, $0f, $f6
db $a9, $39, $92, $20, $aa, $41, $9f, $8d
db $8b, $68, $e6, $a2, $a2, $42, $ae, $dd
db $cb, $f8, $aa, $41, $5f, $e3, $5f, $21
db $1e, $36, $52, $fa, $4c, $b9, $1f, $42
db $f4, $10, $8a, $58, $9f, $e6, $08, $66
db $e9, $35, $74, $e7, $d8, $15, $4c, $98
db $e1, $53, $69, $27, $40, $7d, $18, $98
db $c1, $d3, $9d, $fd, $b0, $6d, $3e, $6a
db $b5, $f7, $4d, $36, $60, $da, $9e, $06
db $03, $db, $7c, $72, $3b, $b2, $82, $8a
db $55, $51, $ff, $bb, $5c, $cd, $36, $bf
db $80, $3c, $95, $6b, $93, $27, $17, $df
db $8c, $ba, $8d, $76, $d8, $f5, $ca, $f5
db $98, $ff, $97, $10, $6d, $a4, $d2, $4f
db $85, $bf, $72, $88, $44, $3a, $e7, $c0
db $ae, $fe, $5e, $4e, $8b, $1c, $a7, $12
db $13, $30, $7b, $55, $34, $54, $7a, $62
db $0a, $2d, $35, $16, $9b, $e8, $b0, $48
db $e1, $6a, $0a, $a2, $33, $1f, $1d, $5b
db $5b, $0c, $d0, $81, $e6, $7e, $a9, $db
db $a6, $0d, $c0, $11, $46, $5d, $a9, $ab
db $42, $0f, $09, $4d, $3f, $36, $c0, $c9
db $72, $ce, $1f, $20, $9b, $48, $3d, $d4
db $6c, $5f, $d4, $e8, $b2, $58, $9d, $82
db $20, $bb, $45, $88, $ad, $67, $d0, $ac
db $04, $ff, $ec, $b9, $83, $17, $f6, $9d
db $cb, $85, $33, $16, $c4, $8b, $c1, $4f
db $d9, $64, $f5, $35, $97, $61, $87, $17
db $81, $9d, $90, $8f, $f7, $d2, $44, $e3
db $44, $ff, $21, $96, $17, $0d, $49, $c4
db $01, $09, $12, $61, $18, $3b, $27, $68
db $fd, $51, $0f, $65, $eb, $75, $93, $e9
db $dd, $0a, $7f, $23, $89, $fd, $dc, $90
db $b5, $e8, $73, $4b, $f6, $5a, $5c, $75
db $97, $41, $7a, $e9, $81, $d1, $1f, $15
db $20, $73, $83, $4b, $12, $12, $8f, $d1
db $94, $09, $27, $59, $2c, $7b, $02, $c6
db $40, $5f, $0f, $38, $b4, $f6, $07, $8a
db $d4, $09, $a8, $be, $a7, $d6, $29, $4c
db $88, $d9, $3c, $ff, $db, $3c, $76, $92
db $61, $9f, $46, $22, $8b, $46, $59, $62
db $f7, $ca, $1d, $8e, $ec, $6e, $89, $22
db $36, $70, $5f, $db, $d2, $7b, $f9, $e8
db $c1, $03, $3c, $2a, $bd, $89, $3d, $c9
db $62, $6c, $48, $50, $b5, $df, $2a, $be
db $32, $ac, $0b, $eb, $6c, $77, $9b, $58
db $30, $93, $e6, $b9, $5f, $b9, $b0, $22
db $9e, $ac, $5d, $e9, $b9, $39, $3b, $a7
db $86, $f1, $fc, $6f, $d1, $55, $77, $85
db $d1, $ec, $31, $46, $91, $fc, $8a, $f3
db $3b, $a2, $2f, $04, $93, $7d, $a9, $45
db $11, $9b, $9b, $74, $6c, $fc, $16, $9f
db $ef, $37, $eb, $4d, $b1, $ac, $cd, $1b
db $24, $34, $d6, $4b, $13, $62, $16, $96
db $3c, $cd, $9d, $4d, $13, $c0, $1e, $e3
db $9a, $35, $dc, $4e, $ac, $f2, $09, $78
db $f7, $f4, $c0, $87, $1b, $5e, $23, $d0
db $98, $28, $b2, $c9, $ca, $12, $0f, $27
db $6a, $2f, $89, $ff, $7e, $34, $08, $c9
db $71, $5b, $d0, $f7, $fd, $a3, $ce, $00
db $43, $10, $da, $24, $84, $1d, $8e, $0a
db $97, $4b, $0d, $f1, $d8, $59, $55, $08
db $6a, $61, $65, $c0, $ff, $bc, $ff, $c6
db $aa, $44, $4a, $f2, $bb, $b1, $8f, $0a
db $34, $5e, $40, $d1, $92, $74, $77, $be
db $dc, $bd, $55, $05, $0c, $33, $a4, $da
db $93, $96, $c9, $5a, $c1, $c4, $44, $d5
db $ff, $28, $43, $47, $ae, $5b, $82, $fa
db $e8, $a4, $30, $6a, $17, $35, $81, $a9
db $56, $c7, $11, $fc, $5c, $ca, $dc, $96
db $45, $6f, $46, $ce, $99, $89, $d2, $31
db $84, $6b, $e3, $73, $d0, $8c, $a6, $86
db $1b, $2b, $dc, $81, $46, $ad, $0b, $87
db $bb, $9c, $d2, $56, $cd, $29, $75, $35
db $15, $9b, $56, $eb, $4f, $d0, $ed, $74
db $6e, $94, $67, $c1, $cb, $10, $e4, $5c
db $68, $5f, $ea, $75, $9a, $d9, $1d, $0a
db $b8, $59, $27, $79, $b4, $4e, $40, $f9
db $97, $d6, $54, $39, $9f, $b6, $01, $65
db $c3, $a9, $79, $6a, $ab, $ca, $6d, $81
db $88, $f2, $c3, $14, $df, $dd, $a1, $f2
db $2f, $19, $1d, $fc, $73, $93, $a2, $f8
db $62, $9a, $b2, $db, $6e, $1f, $f8, $2f
db $37, $59, $a9, $d2, $1e, $8d, $c5, $79
db $5f, $6d, $85, $f7, $79, $c8, $26, $73
db $21, $a7, $51, $8e, $37, $5a, $bb, $2b
db $50, $26, $53, $37, $c4, $27, $7d, $72
db $0e, $c5, $ca, $b9, $62, $1f, $33, $64
db $09, $9f, $66, $e6, $12, $b1, $75, $c0
db $07, $b2, $8b, $e5, $54, $85, $4c, $7c
db $41, $ef, $28, $f5, $b2, $6f, $e9, $29
db $f4, $3d, $1d, $f7, $fe, $89, $a9, $38
db $bd, $f9, $2f, $8d, $d7, $2d, $c1, $cc
db $87, $7c, $6c, $e5, $9c, $85, $35, $61
db $37, $cf, $7e, $a2, $af, $e2, $87, $9e
db $ae, $18, $ba, $0e, $b9, $8f, $c3, $94
db $1d, $98, $43, $4f, $c6, $88, $c8, $eb
db $92, $c5, $1d, $79, $1c, $20, $88, $a7
db $54, $fe, $a6, $61, $4a, $6b, $83, $6c
db $46, $97, $61, $6f, $d4, $e2, $87, $18
db $b2, $fe, $a0, $a7, $d9, $0d, $e0, $44
db $3f, $48, $c4, $62, $ee, $cc, $37, $c2
db $78, $3b, $70, $a0, $b8, $dc, $78, $3b
db $a6, $3a, $7e, $43, $5d, $33, $ab, $12
db $fd, $1a, $98, $03, $a1, $1c, $d0, $09
db $93, $30, $c9, $0a, $52, $d2, $87, $9f
db $a4, $0b, $0c, $03, $30, $e1, $e3, $8d
db $4a, $98, $09, $ac, $8a, $b9, $9d, $15
db $19, $72, $e5, $a4, $dc, $ff, $76, $e8
db $6e, $fd, $6d, $b7, $9f, $41, $d4, $c6
db $91, $74, $43, $b4, $e7, $03, $3f, $bc
db $f6, $cd, $0a, $3e, $9c, $54, $bc, $68
db $fc, $7b, $68, $78, $0c, $18, $7b, $c7
db $aa, $fd, $6f, $07, $bb, $c6, $74, $ce
db $07, $8e, $98, $68, $86, $fb, $61, $e5
db $37, $29, $24, $5e, $bf, $ad, $b5, $d7
db $f3, $d6, $75, $3f, $52, $f6, $19, $17
db $50, $f4, $99, $b6, $0a, $41, $a9, $f4
db $14, $1a, $ba, $dc, $e5, $57, $b0, $8e
db $dc, $63, $16, $40, $65, $34, $d0, $03
db $a0, $b7, $af, $03, $68, $ee, $df, $39
db $7b, $e1, $3b, $c0, $11, $16, $a4, $0c
db $8b, $90, $1b, $98, $50, $0d, $4c, $c1
db $49, $a0, $48, $f2, $a7, $67, $e1, $27
db $82, $cc, $0e, $bf, $c7, $45, $35, $32
db $0d, $45, $7f, $d7, $ca, $7b, $cc, $27
db $94, $bc, $22, $46, $a2, $ad, $cb, $ef
db $d2, $8a, $a4, $2f, $bd, $7d, $0f, $f5
db $00, $54, $40, $b1, $26, $48, $5f, $0e
db $c0, $b6, $30, $1f, $91, $9a, $b8, $a2
db $53, $6f, $c2, $53, $28, $77, $f0, $73
* = D5BASE
db $f0, $9e, $3d, $0b, $94, $00, $e8, $d2
db $87, $17, $46, $17, $6a, $ee, $90, $91
db $b3, $40, $46, $2f, $27, $29, $69, $1f
db $ba, $d6, $1b, $c7, $c5, $3e, $b4, $50
db $4a, $ad, $39, $cf, $e5, $5b, $06, $41
db $f9, $7e, $ee, $40, $01, $66, $c5, $e2
db $8c, $cf, $ca, $95, $3a, $94, $f9, $cb
db $2c, $ba, $b3, $2b, $ee, $e2, $eb, $12
db $7c, $e2, $77, $20, $97, $09, $1b, $c1
db $f1, $b0, $57, $c7, $13, $ee, $ee, $f0
db $3e, $cb, $f1, $e3, $88, $de, $19, $5e
db $fb, $23, $a2, $d7, $8c, $bb, $42, $41
db $33, $6e, $9f, $5f, $b5, $15, $f3, $e6
db $7c, $fb, $c2, $9d, $11, $4f, $e0, $52
db $66, $2a, $5d, $79, $7c, $64, $70, $81
db $09, $17, $1e, $ad, $67, $af, $3f, $49
db $52, $e9, $d6, $df, $df, $f9, $f4, $d7
db $9c, $de, $d8, $dc, $74, $36, $21, $88
db $5d, $76, $20, $20, $ff, $98, $71, $5e
db $4c, $48, $9c, $a1, $5e, $e4, $f9, $09
db $c0, $3d, $1f, $86, $1a, $8b, $48, $fd
db $19, $3d, $f5, $4a, $47, $32, $df, $f9
db $c9, $59, $92, $71, $ba, $75, $94, $18
db $ec, $d5, $62, $6b, $5e, $8d, $91, $21
db $1c, $c3, $41, $58, $a7, $4e, $08, $40
db $1d, $ad, $c2, $6b, $bd, $ac, $93, $07
db $47, $79, $22, $e8, $62, $66, $57, $7a
db $dd, $74, $d4, $04, $f1, $09, $52, $20
db $8d, $c7, $2e, $93, $29, $61, $b4, $9e
db $d8, $f3, $58, $f7, $ba, $87, $d0, $9f
db $a9, $9d, $07, $8d, $a0, $c1, $1a, $01
db $03, $3b, $15, $9d, $31, $bd, $2b, $e7
db $69, $d9, $67, $98, $c6, $99, $cb, $53
db $35, $cf, $c3, $82, $8e, $b9, $2e, $49
db $a8, $fe, $4c, $52, $25, $27, $c3, $1b
db $8c, $6c, $23, $12, $09, $9b, $c4, $e6
db $f1, $47, $3f, $24, $7a, $12, $58, $89
db $2b, $d7, $0b, $19, $77, $e9, $88, $04
db $f6, $e3, $a1, $c6, $91, $32, $10, $0a
db $43, $12, $49, $07, $26, $6d, $8a, $96
db $8c, $93, $ee, $1a, $3b, $44, $1e, $5c
db $7e, $75, $96, $2c, $da, $22, $57, $5d
db $a3, $7d, $8b, $5f, $e0, $4f, $16, $07
db $8a, $c6, $6e, $b3, $53, $e1, $9e, $a9
db $ff, $ac, $4c, $9e, $ed, $56, $2e, $57
db $b5, $f6, $c1, $15, $9e, $0d, $ad, $61
db $52, $74, $58, $bf, $48, $0e, $45, $c5
db $ef, $04, $b7, $8e, $e7, $46, $d9, $e0
db $cb, $8a, $30, $bc, $56, $39, $23, $bb
db $03, $fc, $c1, $de, $43, $df, $29, $47
db $1f, $4d, $3c, $71, $ea, $6b, $78, $21
db $77, $eb, $2c, $a3, $d6, $99, $5f, $6c
db $24, $c3, $8b, $a0, $3f, $20, $37, $aa
db $7f, $76, $a9, $ba, $1a, $32, $a7, $53
db $ba, $ad, $09, $68, $50, $51, $53, $d0
db $91, $7c, $9d, $97, $8b, $3a, $d5, $5a
db $c8, $0c, $c9, $ac, $f7, $58, $1e, $4a
db $61, $15, $ea, $a3, $8d, $12, $e8, $9f
db $75, $0e, $f1, $ba, $94, $f8, $a8, $7e
db $5d, $43, $f2, $5e, $fc, $dd, $a2, $9c
db $a0, $3a, $e0, $7f, $e2, $34, $5d, $9e
db $b2, $26, $1e, $ef, $47, $fc, $31, $31
db $2b, $2c, $e3, $c9, $af, $48, $cb, $e6
db $62, $5b, $ce, $48, $d6, $45, $5c, $2d
db $17, $05, $97, $a1, $27, $d5, $58, $4e
db $7d, $ae, $68, $f9, $c9, $de, $fb, $f6
db $fa, $d5, $39, $f4, $3c, $ed, $16, $78
db $57, $99, $2f, $f1, $c2, $a1, $74, $7d
db $e3, $40, $1c, $41, $dc, $82, $c9, $4d
db $db, $c0, $e2, $84, $1e, $f9, $51, $50
db $9d, $01, $eb, $46, $bc, $9a, $95, $ed
db $13, $d1, $14, $da, $06, $1f, $fe, $b2
db $e0, $5e, $1f, $d8, $48, $7a, $a3, $09
db $e2, $87, $eb, $ee, $60, $a0, $c3, $fa
db $c0, $d4, $1d, $4b, $2f, $73, $ae, $49
db $28, $cb, $16, $3e, $f6, $82, $6f, $70
db $80, $59, $d6, $b6, $e4, $e1, $1e, $f6
db $3c, $b0, $26, $71, $6c, $32, $34, $fc
db $ee, $f8, $5e, $6c, $e1, $09, $dc, $b5
db $3d, $51, $6a, $12, $87, $b0, $96, $24
db $04, $dc, $f7, $59, $b7, $35, $f6, $8d
db $77, $60, $06, $1b, $b8, $b3, $84, $fc
db $d7, $31, $02, $db, $30, $55, $c0, $3c
db $a8, $45, $39, $e5, $f3, $8b, $fc, $f2
db $94, $e3, $46, $74, $3f, $dc, $23, $70
db $6e, $3f, $29, $fe, $d6, $b9, $a2, $47
db $85, $42, $66, $e7, $4f, $15, $0d, $7f
db $e9, $ff, $39, $50, $29, $26, $5d, $c7
db $93, $b9, $0f, $11, $b6, $7d, $14, $04
db $06, $6b, $3a, $3d, $ea, $c7, $bc, $ff
db $08, $e3, $fa, $ef, $ad, $8b, $59, $7d
db $74, $87, $d1, $7a, $2f, $d8, $82, $34
db $09, $ef, $39, $58, $f6, $33, $57, $c9
db $7b, $63, $3a, $58, $75, $0b, $e4, $70
db $34, $59, $ec, $1f, $14, $91, $01, $9c
db $d9, $e2, $7d, $c4, $46, $27, $7f, $ff
db $0a, $82, $c3, $92, $8a, $25, $b5, $97
db $40, $b1, $4f, $96, $c5, $9a, $c2, $83
db $9d, $88, $d3, $6a, $f3, $48, $90, $26
db $5d, $c7, $96, $09, $c7, $a2, $72, $74
db $b1, $4c, $c3, $24, $02, $e8, $21, $03
db $95, $65, $9e, $17, $4d, $9e, $1e, $7d
db $39, $02, $91, $6e, $86, $9c, $39, $b1
db $50, $cb, $60, $64, $a6, $7e, $13, $6e
db $c2, $2a, $cb, $f6, $fc, $d6, $f6, $f8
db $73, $60, $64, $9e, $78, $0a, $47, $66
db $62, $45, $43, $67, $96, $b5, $8a, $b7
db $b4, $dd, $05, $fa, $08, $87, $db, $00
db $b9, $d8, $51, $60, $18, $9b, $31, $3e
db $52, $91, $0a, $3b, $a2, $08, $2b, $80
db $18, $38, $c9, $6e, $a2, $64, $db, $e3
db $9d, $f6, $a4, $56, $71, $dc, $18, $11
db $03, $0b, $e8, $06, $65, $15, $c8, $3a
db $e3, $92, $b5, $64, $07, $c7, $88, $87
db $38, $cb, $01, $f2, $09, $b8, $09, $98
db $76, $d2, $76, $20, $28, $bb, $d1, $ad
db $65, $0c, $c5, $72, $e7, $83, $8d, $bd
db $40, $3d, $68, $c2, $cc, $3f, $03, $01
db $79, $c6, $67, $5c, $52, $de, $d3, $b1
db $96, $61, $c1, $b1, $60, $6d, $08, $25
db $b5, $47, $68, $e0, $8e, $fd, $96, $ab
db $5e, $9b, $8b, $51, $90, $71, $61, $0d
db $0c, $d8, $75, $b3, $4e, $4b, $f3, $cd
db $59, $82, $dc, $e7, $67, $64, $5b, $67
db $21, $22, $ea, $e7, $a3, $a3, $b8, $7b
db $fb, $50, $b7, $a3, $38, $53, $c7, $1c
db $b1, $64, $da, $ba, $90, $f6, $aa, $13
db $4b, $80, $f8, $24, $8e, $57, $53, $67
db $5d, $b8, $cd, $7c, $8c, $d4, $0c, $93
db $e4, $a5, $9b, $95, $b1, $69, $b2, $43
db $db, $87, $80, $8d, $5c, $b3, $6d, $06
db $ee, $bb, $79, $b8, $17, $23, $21, $8b
db $c7, $1a, $3e, $42, $5f, $d1, $ee, $10
db $36, $d8, $15, $3a, $d1, $11, $96, $e5
db $34, $63, $73, $01, $76, $a0, $67, $c3
db $08, $94, $94, $63, $88, $d6, $9c, $af
db $35, $28, $78, $37, $28, $08, $67, $fa
db $2c, $14, $4b, $ed, $ba, $df, $44, $5c
db $9d, $fb, $c4, $13, $2e, $ac, $ca, $d0
db $e3, $3f, $40, $0f, $bb, $30, $06, $59
db $6a, $18, $ed, $90, $58, $c1, $1f, $b2
db $84, $5c, $72, $76, $6d, $24, $41, $2f
db $8b, $cd, $b6, $f9, $f6, $82, $b5, $5e
db $1a, $25, $01, $d1, $3b, $c7, $13, $de
db $b8, $8b, $f5, $44, $92, $08, $37, $ac
db $d7, $4f, $ea, $b8, $89, $81, $e7, $eb
db $0d, $80, $0f, $68, $b3, $50, $7f, $dc
db $07, $65, $6d, $0d, $e2, $88, $b7, $f0
db $06, $17, $41, $d0, $8c, $f0, $59, $be
db $ed, $da, $f0, $4b, $2f, $5a, $5e, $cd
db $92, $e2, $93, $80, $7a, $73, $de, $c1
db $e8, $00, $f4, $b1, $24, $a2, $2c, $75
db $80, $c1, $7c, $a8, $0c, $34, $28, $7e
db $3a, $1f, $62, $53, $28, $ae, $4d, $cd
db $7c, $64, $c5, $59, $15, $02, $9f, $8b
db $ea, $b5, $e4, $14, $e3, $62, $f6, $3e
db $8f, $fc, $7d, $b5, $56, $c8, $b4, $98
db $11, $65, $9d, $2d, $6e, $53, $99, $15
db $72, $85, $8f, $b0, $9e, $ce, $0b, $c1
db $7d, $56, $a8, $4e, $4a, $e0, $19, $ed
db $9a, $2c, $15, $f6, $bf, $a5, $cc, $eb
db $e0, $6c, $e8, $3f, $a2, $4c, $d0, $f9
db $e9, $09, $04, $ae, $fd, $93, $ed, $e1
db $37, $b6, $48, $d0, $d4, $9f, $b2, $1c
db $08, $1e, $50, $01, $ca, $d1, $e5, $66
db $a7, $6e, $c0, $7c, $ef, $74, $d6, $9a
db $cd, $dc, $39, $02, $4c, $96, $ad, $6a
db $54, $7d, $5b, $ca, $db, $76, $79, $7a
db $02, $04, $e6, $71, $1c, $65, $31, $ba
db $13, $88, $bf, $cd, $d3, $9e, $92, $90
db $42, $29, $59, $a4, $87, $15, $b9, $4c
db $f7, $23, $91, $ae, $c6, $e3, $e7, $2e
db $1f, $c8, $72, $fe, $57, $04, $86, $34
db $30, $67, $76, $14, $d2, $1c, $ee, $58
db $d9, $43, $82, $59, $ba, $cb, $0d, $81
db $db, $4d, $16, $f0, $23, $42, $5c, $86
db $78, $98, $20, $8f, $45, $d6, $9c, $19
db $4c, $53, $a8, $23, $04, $1d, $6b, $b5
db $8c, $99, $67, $e8, $e4, $99, $c0, $7a
db $5d, $4c, $f2, $52, $bd, $b0, $b2, $a5
db $6a, $28, $3e, $99, $63, $63, $58, $5d
db $9e, $6b, $9b, $2e, $ce, $dc, $37, $ce
db $51, $56, $c8, $66, $e7, $d7, $82, $96
db $e2, $5e, $01, $6c, $45, $3e, $19, $03
db $4d, $bb, $d4, $47, $83, $73, $11, $53
db $00, $12, $f3, $85, $46, $83, $26, $68
db $1e, $8d, $6a, $ec, $95, $b1, $50, $e7
db $e9, $ba, $a7, $ae, $bf, $73, $19, $96
db $a6, $ca, $fd, $ea, $12, $d2, $5d, $11
db $54, $b1, $62, $61, $36, $25, $44, $2d
db $86, $67, $17, $26, $5f, $07, $82, $33
db $73, $1b, $b4, $6d, $d2, $a5, $41, $7a
db $3b, $10, $32, $89, $90, $74, $1d, $f4
db $74, $7d, $f9, $5c, $a1, $84, $20, $54
db $73, $b7, $7c, $05, $13, $9f, $c8, $a8
db $5c, $52, $ce, $3d, $0e, $b2, $5f, $64
db $10, $25, $82, $71, $b1, $96, $ae, $99
db $38, $f0, $19, $50, $9a, $58, $83, $c3
db $4f, $81, $79, $c8, $7a, $e6, $7e, $d2
db $6f, $7d, $5a, $98, $84, $3d, $7c, $62
db $81, $ba, $e6, $1f, $a4, $89, $1c, $58
db $d7, $41, $92, $6d, $5a, $54, $fc, $90
db $be, $3f, $a6, $88, $01, $b6, $b0, $a9
db $3a, $09, $6e, $87, $5e, $29, $d1, $2e
db $93, $05, $5a, $61, $dd, $38, $37, $d3
db $50, $75, $ad, $27, $73, $93, $8a, $9e
db $60, $a1, $56, $6d, $40, $ac, $7d, $6d
db $28, $92, $ea, $f3, $45, $ee, $c4, $56
db $00, $03, $ca, $8c, $4d, $3b, $21, $90
db $41, $0f, $44, $62, $65, $e8, $25, $7d
db $43, $13, $8d, $e2, $ec, $58, $c8, $8d
db $db, $23, $28, $03, $e3, $1c, $b4, $c3
db $b8, $2c, $95, $9a, $dd, $05, $0b, $66
db $1e, $e9, $56, $4e, $18, $ba, $92, $8e
db $31, $fd, $f2, $ae, $c2, $f7, $25, $5d
db $46, $a2, $78, $25, $27, $60, $ce, $73
db $5c, $69, $d0, $43, $d9, $6d, $1c, $65
db $e8, $b5, $30, $53, $0e, $55, $e8, $04
db $87, $29, $79, $f2, $6e, $b2, $74, $0a
db $70, $40, $6c, $ef, $e2, $d4, $62, $2a
db $cc, $2d, $5a, $be, $8b, $9e, $e4, $b7
db $b5, $08, $d3, $50, $f2, $5c, $c2, $9a
db $1e, $9e, $ff, $10, $54, $4a, $06, $f0
db $ab, $bc, $d7, $40, $cb, $8d, $28, $6d
db $0e, $36, $4a, $d2, $da, $ef, $6d, $a0
db $0f, $15, $de, $70, $f4, $25, $c3, $49
db $ab, $ed, $fd, $54, $bd, $cc, $79, $f3
db $14, $6b, $2c, $64, $ad, $3e, $ca, $f3
db $46, $e9, $43, $b3, $4d, $19, $34, $d2
db $a8, $2e, $4f, $d6, $22, $e3, $1d, $69
db $c4, $12, $60, $e4, $20, $7d, $f9, $67
db $8c, $78, $df, $1d, $17, $90, $86, $ed
db $b4, $53, $c9, $1f, $90, $35, $60, $e4
db $9e, $99, $c1, $b6, $d9, $4e, $03, $55
db $33, $fd, $3f, $51, $59, $44, $c7, $bb
db $1c, $d8, $00, $c0, $cf, $58, $8d, $36
db $c8, $dc, $68, $26, $71, $bb, $fe, $88
db $c0, $e4, $6b, $94, $f7, $1f, $ac, $ae
db $98, $29, $66, $d8, $7d, $88, $61, $ed
db $78, $47, $e8, $29, $5a, $34, $ef, $50
db $2d, $be, $51, $df, $67, $df, $ec, $d6
db $e3, $11, $06, $64, $12, $d1, $6b, $37
db $d9, $42, $da, $f4, $05, $1c, $87, $16
db $19, $74, $ce, $23, $10, $a4, $1b, $bf
db $3a, $05, $6f, $9b, $60, $bf, $90, $51
db $6a, $14, $92, $e1, $b2, $39, $6d, $ef
db $4f, $e8, $6d, $54, $5e, $a0, $9b, $fc
db $44, $0e, $62, $0e, $0f, $ef, $cb, $87
db $1a, $1e, $6c, $c9, $a2, $57, $38, $59
db $74, $4f, $5c, $cb, $73, $65, $7d, $ba
db $49, $bd, $1f, $e9, $72, $3f, $2c, $61
db $53, $c4, $f4, $1c, $d2, $e4, $2f, $ba
db $c5, $ff, $cc, $9b, $58, $d1, $3b, $f7
db $54, $25, $7a, $c8, $5d, $57, $5b, $d4
db $17, $28, $13, $c3, $44, $39, $c5, $83
db $e8, $a6, $4f, $ab, $f2, $bb, $c0, $59
db $5c, $e2, $0c, $f5, $16, $a8, $94, $87
db $9d, $e1, $f7, $19, $2b, $be, $8e, $13
db $f4, $8f, $4c, $7e, $25, $8b, $59, $ea
db $44, $b5, $a9, $f3, $6b, $33, $72, $b7
db $90, $2e, $ce, $8d, $fb, $9a, $4b, $9e
db $d6, $25, $f5, $85, $72, $4d, $fb, $eb
db $6e, $fa, $49, $24, $ed, $68, $ac, $8a
db $cf, $18, $70, $02, $df, $0e, $70, $5d
db $05, $c1, $5e, $1d, $90, $88, $5d, $59
db $7a, $ee, $a9, $2c, $7c, $be, $5b, $73
db $72, $29, $b9, $4e, $db, $8e, $fc, $84
db $a6, $ec, $62, $a0, $2e, $06, $44, $31
db $47, $82, $9a, $2f, $24, $5f, $57, $53
db $d7, $a2, $a7, $0a, $af, $fe, $a7, $5d
db $1b, $66, $e5, $8a, $c3, $56, $8b, $40
db $be, $01, $7d, $67, $dd, $9f, $08, $e5
db $09, $52, $eb, $41, $7f, $b7, $08, $36
db $7f, $bc, $46, $60, $c7, $7c, $f4, $80
db $b6, $59, $aa, $a4, $da, $0f, $a7, $2b
db $68, $3e, $22, $37, $8d, $b3, $b9, $1c
db $16, $ce, $e3, $4b, $00, $d5, $ce, $b3
db $9d, $a5, $d1, $5e, $75, $04, $d3, $89
db $0d, $3a, $bc, $6c, $0a, $17, $5b, $e4
db $80, $15, $30, $d5, $bf, $b7, $16, $2c
db $68, $9e, $7d, $57, $96, $f2, $7d, $af
db $c3, $47, $c0, $7e, $e1, $5f, $84, $2b
db $06, $82, $c3, $8f, $57, $89, $3b, $ae
db $14, $05, $d1, $89, $dc, $2d, $09, $f7
db $c2, $2a, $dd, $9a, $86, $18, $de, $4c
db $af, $57, $3f, $04, $21, $96, $5c, $ea
db $aa, $58, $8b, $70, $2b, $9c, $11, $62
db $93, $b0, $78, $50, $c5, $31, $3a, $b2
db $e6, $30, $3b, $ba, $94, $5a, $dd, $62
db $b5, $a9, $db, $fb, $88, $eb, $29, $b0
db $2d, $70, $d9, $ad, $5c, $08, $fd, $28
db $c1, $15, $e9, $96, $75, $3a, $a6, $18
db $56, $62, $53, $ce, $f9, $ee, $05, $65
db $eb, $dd, $63, $92, $0a, $9c, $1b, $22
db $26, $d4, $02, $1f, $fc, $99, $92, $6b
db $04, $77, $92, $21, $ba, $d3, $a3, $ca
db $14, $af, $2a, $74, $08, $06, $ee, $73
db $9e, $d0, $94, $fa, $4a, $95, $40, $4c
db $c5, $4f, $f2, $ce, $3b, $2f, $0e, $ed
db $79, $03, $74, $4e, $7a, $f0, $0a, $a2
db $30, $a3, $b7, $e0, $f6, $38, $c5, $3b
db $b9, $73, $a9, $30, $3a, $fa, $74, $5a
db $43, $c0, $96, $c0, $93, $e5, $0d, $e9
db $91, $cc, $82, $9d, $1a, $c6, $0b, $f9
db $56, $aa, $5d, $87, $a6, $51, $e3, $56
db $97, $91, $b1, $d3, $51, $6c, $27, $c3
db $34, $e1, $fa, $55, $ee, $9d, $d1, $4b
db $1d, $b5, $34, $53, $55, $99, $f8, $64
db $3f, $47, $68, $77, $f9, $ff, $0f, $f9
db $f9, $c9, $f0, $a4, $80, $8d, $67, $df
db $d2, $e8, $26, $ef, $97, $52, $cf, $bf
db $65, $3c, $a5, $80, $68, $96, $06, $3a
db $e9, $1a, $7f, $b5, $8f, $c7, $0c, $54
db $94, $7a, $b5, $cc, $2f, $a5, $a0, $b2
db $aa, $31, $c9, $d0, $bb, $a2, $24, $e1
db $1c, $f0, $ca, $aa, $52, $72, $96, $ee
db $fc, $35, $fa, $4f, $6c, $31, $af, $02
db $7f, $12, $97, $69, $3b, $11, $9f, $54
db $b7, $aa, $0c, $f7, $14, $92, $38, $38
db $8f, $22, $c6, $8d, $b3, $02, $17, $79
db $fc, $b0, $c6, $0c, $34, $df, $d9, $ab
db $48, $b5, $6b, $ae, $c7, $30, $bc, $f4
db $87, $6f, $50, $57, $4c, $9d, $1e, $53
db $ba, $23, $da, $91, $b4, $68, $d4, $7f
db $74, $71, $db, $9a, $4b, $2f, $0f, $8d
db $22, $93, $71, $99, $4c, $44, $6e, $5f
db $f0, $6b, $1c, $e0, $ad, $9f, $89, $4e
db $09, $88, $0f, $dc, $51, $a3, $7d, $de
db $75, $ee, $72, $f8, $5f, $ee, $7f, $f1
db $f9, $ad, $1c, $b5, $3b, $a5, $cb, $9e
db $2b, $c1, $d2, $71, $58, $09, $c1, $3c
db $2b, $a5, $ad, $5c, $11, $17, $1d, $5c
db $1a, $ac, $8b, $6d, $b1, $a7, $32, $93
db $66, $03, $9c, $d2, $47, $11, $54, $e3
db $4d, $94, $f9, $aa, $d8, $c6, $ef, $23
db $b5, $ad, $32, $49, $f8, $a9, $f3, $bb
db $ad, $6f, $48, $a5, $ea, $ed, $8e, $07
db $ea, $aa, $0e, $8b, $06, $e3, $60, $32
db $72, $56, $73, $c8, $56, $7f, $57, $9c
db $1a, $6d, $8e, $ca, $b3, $8b, $51, $27
db $e1, $65, $6d, $11, $9f, $92, $e5, $3b
db $5a, $20, $47, $90, $64, $60, $f0, $e7
db $6f, $32, $ea, $fb, $8e, $c5, $6d, $2c
db $ad, $04, $93, $54, $18, $14, $0b, $c0
db $45, $a5, $3d, $00, $0c, $b5, $ab, $aa
db $c1, $82, $ac, $84, $f3, $b1, $1f, $3c
db $8c, $5a, $43, $1b, $e0, $33, $2d, $0f
db $a9, $4d, $4e, $c8, $32, $d3, $e4, $60
db $70, $1b, $d1, $f2, $8c, $90, $78, $d0
db $44, $36, $a1, $56, $1a, $e4, $13, $62
db $f4, $39, $32, $65, $cc, $ef, $a2, $ba
db $12, $f1, $35, $3a, $bb, $36, $39, $0c
db $87, $75, $62, $e5, $3e, $5f, $fd, $90
db $53, $8c, $43, $ed, $0b, $b9, $77, $67
db $e2, $d7, $0c, $00, $05, $16, $3a, $8b
db $f4, $a6, $60, $64, $14, $29, $ce, $6b
db $09, $83, $a2, $94, $fa, $3f, $35, $1b
db $56, $cd, $54, $10, $44, $53, $be, $97
db $72, $76, $21, $e3, $b4, $5a, $dc, $78
db $3a, $35, $02, $4c, $78, $40, $28, $02
db $88, $84, $86, $cb, $a5, $26, $d5, $c6
db $85, $f8, $cf, $19, $92, $69, $0c, $97
db $0c, $4b, $95, $fb, $ec, $8e, $0d, $d8
db $c3, $db, $3e, $47, $fc, $02, $28, $fa
db $4a, $b1, $81, $f6, $ed, $55, $5b, $98
db $e3, $c8, $43, $b4, $f7, $ec, $4a, $36
db $eb, $81, $54, $0d, $4b, $6c, $47, $21
db $e0, $05, $96, $b4, $fa, $43, $0c, $87
db $0e, $70, $6b, $c7, $8a, $ce, $e5, $93
db $ea, $4a, $c9, $ca, $2f, $b0, $a3, $25
db $ea, $e7, $3b, $4a, $9d, $58, $93, $0b
db $0b, $96, $6f, $bd, $1c, $01, $41, $1d
db $e5, $ff, $3f, $b0, $47, $cc, $4c, $35
db $4b, $15, $d1, $dd, $53, $9d, $c2, $4e
db $c0, $6f, $6f, $5d, $7c, $1f, $26, $8e
db $26, $dd, $84, $5e, $62, $05, $78, $91
db $dd, $d1, $8b, $30, $6c, $71, $15, $64
db $35, $c1, $58, $6a, $2c, $3e, $c8, $e5
db $d0, $1c, $d1, $69, $27, $37, $bf, $aa
db $91, $2e, $2b, $f8, $30, $e1, $a4, $2a
db $53, $06, $a6, $51, $da, $d2, $6d, $5e
db $d1, $c2, $2d, $71, $d8, $35, $56, $79
db $1e, $ec, $19, $e6, $f7, $47, $fa, $49
db $68, $88, $60, $ef, $38, $6f, $67, $8a
db $f0, $ab, $4a, $51, $ea, $5b, $f9, $2b
db $f6, $0f, $2c, $73, $5e, $e8, $42, $e2
db $ce, $b3, $4e, $c5, $97, $18, $14, $5b
db $7a, $31, $fe, $b0, $8a, $5d, $bb, $b8
db $a3, $7c, $9d, $90, $00, $82, $15, $a1
db $6d, $d8, $27, $2e, $ce, $18, $ec, $87
db $0b, $79, $4b, $df, $d5, $92, $c0, $aa
db $8f, $1e, $2e, $b5, $96, $e5, $90, $20
db $50, $18, $30, $73, $e4, $c2, $d8, $1a
db $5b, $8d, $37, $27, $20, $be, $e6, $24
db $c0, $2c, $08, $11, $0a, $5a, $46, $49
db $3e, $e6, $e2, $65, $fa, $df, $b7, $ad
db $92, $0c, $e3, $50, $72, $76, $46, $ff
db $cb, $ad, $93, $fa, $0d, $ea, $ae, $d9
db $6d, $6c, $d8, $75, $59, $f2, $2c, $0d
db $98, $a4, $3e, $dc, $81, $a4, $f6, $fa
db $65, $ea, $ea, $6f, $63, $b6, $e4, $fa
db $76, $25, $3d, $f9, $16, $78, $ac, $96
db $ba, $7f, $c6, $02, $e6, $ee, $ae, $24
db $67, $ba, $64, $2a, $55, $ba, $1c, $a7
db $a0, $b5, $f8, $23, $14, $65, $d8, $b2
db $cc, $ad, $2b, $44, $98, $d9, $6a, $6b
db $37, $15, $ca, $93, $f9, $bf, $ed, $70
db $61, $81, $61, $ae, $75, $b4, $aa, $4d
db $9e, $02, $df, $fe, $ec, $28, $20, $02
db $a1, $87, $9f, $25, $51, $16, $46, $c1
db $b0, $87, $55, $66, $dd, $43, $ef, $96
db $2e, $4e, $38, $05, $87, $07, $dd, $30
db $8f, $54, $c3, $4b, $d6, $cb, $59, $1b
db $6a, $cd, $34, $97, $ed, $f9, $45, $09
db $4d, $52, $f9, $b3, $7a, $e1, $ef, $49
db $12, $96, $2d, $e3, $dd, $40, $5e, $96
db $56, $3f, $9a, $10, $03, $01, $fb, $82
db $49, $33, $4f, $27, $e2, $4e, $b8, $34
db $22, $96, $bc, $24, $8a, $97, $63, $84
db $7a, $a5, $84, $48, $37, $52, $c0, $af
db $07, $e6, $e6, $db, $e1, $21, $8c, $26
db $78, $44, $7b, $d8, $d9, $24, $b4, $c8
db $4b, $40, $9a, $b7, $5d, $65, $50, $3a
db $40, $18, $65, $fd, $d1, $4e, $73, $8b
db $b6, $0c, $0b, $61, $f1, $92, $2e, $52
db $20, $44, $70, $4b, $75, $4f, $e5, $c9
db $17, $36, $b0, $71, $f4, $30, $42, $d6
db $56, $ab, $f5, $34, $62, $cc, $90, $14
db $0f, $db, $3f, $72, $48, $a1, $a1, $2d
db $8e, $82, $93, $36, $fc, $cd, $5e, $ad
db $a8, $68, $f0, $0b, $c2, $f2, $9a, $11
db $4b, $b0, $9c, $6a, $ef, $ac, $4e, $bd
db $1c, $25, $f2, $05, $14, $23, $d6, $f1
db $e7, $a6, $64, $b0, $05, $41, $10, $ae
db $7d, $d0, $95, $75, $d1, $18, $c0, $c2
db $60, $e3, $d0, $6d, $eb, $fd, $0e, $5d
db $8d, $d3, $31, $ed, $64, $58, $5f, $69
db $24, $f5, $b3, $d4, $a7, $90, $08, $5b
db $d1, $36, $83, $df, $a3, $bb, $5f, $5b
db $87, $76, $ff, $63, $15, $33, $57, $e3
db $12, $a9, $ac, $32, $22, $20, $75, $c4
db $b3, $e9, $0a, $65, $4e, $ce, $97, $be
db $f4, $c7, $8c, $dd, $fa, $c5, $0b, $47
db $0f, $c2, $86, $4b, $c6, $9c, $d7, $75
db $c1, $de, $fc, $3e, $5b, $ff, $89, $9e
db $79, $69, $4f, $33, $06, $fc, $18, $e0
db $a3, $b9, $93, $72, $ee, $4e, $45, $45
db $d4, $51, $04, $fd, $e6, $a6, $05, $93
db $c6, $74, $cb, $a7, $4d, $b5, $54, $12
db $a5, $5f, $ff, $79, $7a, $97, $bc, $4d
db $47, $f3, $e8, $a8, $81, $b2, $ff, $8d
db $a0, $33, $62, $bc, $54, $b7, $1f, $3b
db $a0, $24, $aa, $c5, $48, $94, $2a, $69
db $4b, $ed, $68, $83, $f7, $76, $f4, $14
db $ca, $ae, $a3, $cf, $19, $20, $98, $f2
db $ee, $a2, $f7, $c1, $18, $12, $6b, $ca
db $6a, $ab, $45, $88, $1a, $85, $10, $2a
db $61, $8f, $3f, $d3, $a5, $36, $cb, $ad
db $cf, $10, $0b, $78, $1f, $46, $ca, $e7
db $70, $ad, $af, $83, $69, $b1, $d6, $65
db $11, $1e, $6e, $32, $83, $80, $79, $90
db $30, $d4, $90, $b3, $9c, $30, $de, $c5
db $e5, $3b, $5d, $81, $42, $f3, $64, $b5
db $ec, $4b, $2d, $5b, $bf, $ac, $ff, $0c
db $20, $df, $06, $21, $c2, $22, $47, $9e
db $6a, $2d, $bc, $32, $2c, $eb, $e7, $55
db $d7, $d3, $ea, $7d, $9f, $4b, $8f, $9c
db $bb, $89, $9c, $f2, $ae, $92, $e9, $05
db $33, $ce, $64, $2b, $27, $dc, $54, $cc
db $d9, $c7, $ee, $d9, $d3, $b7, $39, $98
db $1a, $3f, $6e, $75, $bf, $25, $c0, $83
db $33, $e6, $e7, $bc, $27, $c6, $e5, $c9
db $7a, $9e, $58, $67, $df, $c7, $2a, $3a
db $90, $b7, $e7, $48, $34, $3d, $8c, $60
db $ce, $4a, $51, $50, $1a, $55, $33, $39
db $75, $b8, $0a, $92, $07, $5f, $31, $23
db $93, $53, $d4, $38, $95, $50, $10, $d3
db $ef, $27, $bc, $6c, $c3, $13, $0f, $16
db $97, $8a, $c6, $3d, $b8, $ad, $52, $60
db $d3, $4f, $9e, $5a, $d5, $66, $ea, $30
db $4e, $91, $09, $01, $d2, $4b, $cb, $9d
db $6d, $e5, $ef, $31, $cd, $e2, $a3, $3e
db $8c, $09, $5c, $ae, $48, $f6, $a1, $66
db $61, $ef, $e1, $d6, $1d, $b9, $2e, $e0
db $08, $16, $df, $a9, $80, $fd, $26, $88
db $59, $33, $fe, $cf, $ab, $1e, $f2, $0d
db $0c, $67, $57, $64, $9b, $33, $1a, $5f
db $a8, $0d, $75, $2f, $87, $e2, $ea, $c4
db $cd, $78, $67, $f4, $55, $88, $73, $c9
db $bc, $d8, $a1, $a9, $09, $47, $7c, $f2
db $e3, $b6, $0d, $58, $a4, $dc, $fd, $7f
db $b5, $94, $f1, $7c, $db, $b8, $d5, $5c
db $c6, $f5, $38, $ac, $1c, $21, $b4, $2a
db $d8, $47, $76, $b2, $22, $aa, $e6, $b9
db $23, $f6, $4a, $53, $67, $7e, $fd, $16
db $33, $c5, $28, $60, $51, $65, $84, $17
db $a5, $f4, $08, $27, $53, $f5, $91, $87
db $b9, $3c, $0c, $5b, $6b, $86, $0f, $70
db $dc, $92, $bc, $18, $6a, $0b, $af, $e4
db $01, $c8, $2a, $bf, $07, $0f, $76, $e5
db $bc, $96, $b0, $25, $02, $6b, $49, $e1
db $d1, $74, $17, $da, $c1, $ce, $33, $17
db $0c, $af, $0e, $29, $b2, $c0, $ba, $d0
db $0a, $1c, $98, $ea, $d0, $af, $bb, $f4
db $4f, $00, $59, $bd, $be, $27, $b6, $4d
db $37, $86, $ee, $73, $7f, $0d, $a2, $07
db $38, $30, $3e, $10, $75, $44, $22, $cf
db $70, $07, $b9, $56, $ee, $5f, $a2, $ef
db $58, $2f, $2a, $86, $45, $d7, $36, $94
db $42, $d1, $11, $b7, $55, $4c, $cb, $cc
db $13, $88, $7c, $35, $42, $0c, $7e, $83
db $d0, $cb, $38, $43, $13, $28, $e4, $12
* = D6BASE
db $12, $09, $ec, $c0, $9a, $8d, $5a, $eb
db $c4, $de, $7b, $5d, $f9, $2f, $a9, $71
db $b2, $57, $47, $a8, $a0, $a2, $a2, $e5
db $36, $ff, $57, $15, $23, $e6, $cd, $d7
db $8b, $72, $0d, $24, $5d, $21, $b8, $4f
db $41, $a0, $a4, $5c, $96, $1d, $64, $2b
db $34, $a2, $b6, $69, $21, $9f, $28, $04
db $d4, $26, $27, $c5, $88, $28, $5f, $e6
db $fc, $04, $42, $86, $23, $14, $1b, $5d
db $76, $1b, $d7, $db, $9c, $40, $a3, $a3
db $19, $9f, $f6, $f3, $fd, $9f, $a8, $b4
db $4f, $b9, $59, $bc, $91, $e4, $2b, $e4
db $5d, $9e, $8b, $b7, $fe, $da, $aa, $cc
db $de, $02, $85, $41, $eb, $93, $97, $df
db $8b, $e9, $b2, $60, $62, $23, $b6, $62
db $73, $27, $ba, $43, $78, $b3, $0a, $34
db $33, $11, $62, $8a, $f7, $ea, $a2, $de
db $43, $04, $be, $ab, $64, $32, $80, $5a
db $42, $d2, $9e, $b0, $7d, $81, $74, $fa
db $1c, $53, $89, $f4, $e0, $4b, $22, $53
db $78, $6d, $e7, $8e, $28, $bc, $1a, $05
db $14, $4f, $8d, $01, $1d, $79, $22, $5e
db $17, $7a, $b3, $0b, $70, $77, $79, $20
db $0e, $6a, $d7, $8f, $f9, $6a, $20, $8f
db $71, $0b, $85, $fc, $23, $14, $81, $e1
db $95, $9e, $5a, $d9, $a0, $50, $40, $f7
db $ff, $70, $67, $1e, $6b, $2a, $02, $bd
db $ed, $ac, $08, $f1, $c8, $5c, $91, $62
db $7c, $1b, $4b, $33, $3f, $96, $59, $aa
db $0c, $a8, $12, $fe, $35, $4b, $6d, $62
db $76, $9c, $a2, $84, $e7, $82, $68, $60
db $b5, $10, $73, $e8, $f0, $0b, $8b, $d5
db $d0, $ba, $b2, $2f, $b9, $c9, $35, $d2
db $e3, $d7, $85, $a4, $dc, $08, $a0, $83
db $71, $3c, $d5, $0c, $c7, $5d, $d0, $8e
db $63, $59, $39, $ab, $53, $99, $40, $d2
db $10, $8d, $4e, $ce, $ed, $35, $66, $f0
db $d9, $2a, $e8, $50, $5b, $4c, $fb, $25
db $4c, $a3, $b0, $b0, $d6, $a3, $42, $9f
db $6c, $2c, $ff, $34, $73, $b5, $79, $39
db $60, $7e, $64, $7b, $09, $84, $e2, $b7
db $ed, $0c, $6e, $0c, $f1, $08, $14, $12
db $cc, $ed, $f8, $f0, $0a, $bb, $74, $96
db $47, $12, $6e, $2f, $ca, $cd, $a0, $ba
db $9e, $83, $0e, $b7, $a2, $9d, $ba, $8c
db $8d, $71, $b0, $56, $1e, $a8, $f2, $5e
db $e6, $23, $70, $dd, $7c, $c9, $d0, $f2
db $d9, $da, $20, $fe, $fc, $1d, $0a, $2d
db $62, $71, $eb, $e7, $2f, $17, $ee, $bd
db $a8, $b6, $41, $39, $bb, $8a, $d1, $67
db $3c, $e6, $64, $ad, $bc, $23, $b1, $17
db $4d, $8c, $6a, $4a, $15, $a1, $e6, $bd
db $e3, $7e, $eb, $22, $1b, $8b, $49, $6b
db $95, $68, $e3, $72, $50, $c3, $e3, $10
db $ac, $ad, $09, $d8, $0f, $d5, $ab, $14
db $28, $a6, $54, $2e, $02, $da, $9e, $0c
db $cd, $4b, $3a, $fa, $b8, $2b, $0e, $fc
db $84, $ad, $f1, $10, $b2, $d5, $4b, $51
db $66, $54, $21, $c4, $ce, $d6, $cd, $f3
db $3a, $e7, $fb, $66, $5a, $e5, $32, $97
db $f9, $74, $01, $6f, $82, $61, $ff, $a3
db $8b, $ab, $97, $c3, $7b, $d8, $36, $25
db $a4, $e3, $98, $bf, $47, $78, $b3, $d7
db $13, $88, $ef, $f6, $46, $23, $a9, $95
db $1e, $58, $19, $7a, $45, $f0, $dd, $30
db $41, $d0, $50, $6b, $93, $d4, $b4, $a6
db $9c, $a4, $6f, $e9, $ba, $8b, $98, $10
db $e5, $14, $b6, $f7, $9c, $b9, $67, $39
db $c9, $70, $5b, $8f, $9e, $43, $c7, $39
db $5e, $f4, $6c, $60, $97, $75, $07, $be
db $b7, $c2, $6a, $6b, $85, $35, $75, $c2
db $74, $55, $f6, $64, $fb, $3e, $37, $2d
db $50, $1b, $f5, $4a, $d4, $e6, $79, $18
db $c7, $b8, $63, $30, $82, $78, $e4, $55
db $a7, $e0, $6a, $18, $53, $07, $c0, $30
db $06, $cd, $3a, $35, $db, $03, $b3, $62
db $48, $c3, $36, $9c, $76, $4c, $55, $69
db $d7, $1d, $5a, $7e, $66, $6c, $73, $dd
db $52, $ab, $24, $3d, $b6, $73, $d2, $95
db $5c, $2d, $2b, $a5, $31, $c4, $41, $a2
db $ab, $61, $96, $5c, $c7, $11, $68, $50
db $b1, $63, $16, $09, $63, $14, $ba, $32
db $06, $af, $95, $fa, $c2, $10, $d4, $ab
db $0d, $41, $4b, $25, $58, $d9, $11, $20
db $cb, $a0, $a1, $ff, $c8, $f1, $8d, $c1
db $54, $7b, $f7, $d7, $8f, $4e, $da, $66
db $f7, $6a, $cd, $a8, $dc, $3c, $c5, $41
db $4f, $4a, $d2, $49, $2e, $8c, $02, $6d
db $d9, $2a, $c5, $d4, $77, $30, $6b, $69
db $51, $7e, $a2, $ee, $94, $38, $6a, $7c
db $a5, $1d, $cb, $7c, $67, $99, $90, $52
db $75, $3d, $d0, $21, $72, $53, $5f, $48
db $b0, $84, $e0, $48, $1a, $36, $8e, $8f
db $78, $a6, $4c, $a5, $11, $22, $e8, $db
db $92, $64, $2c, $f3, $fb, $31, $25, $7f
db $91, $ad, $08, $0f, $d0, $dc, $be, $a7
db $8e, $34, $24, $2d, $32, $b1, $a2, $68
db $f1, $e2, $56, $c1, $1d, $58, $b3, $49
db $ce, $ec, $0e, $9e, $43, $13, $2d, $af
db $57, $6c, $00, $6f, $7d, $a6, $0a, $4b
db $22, $fe, $71, $f2, $42, $67, $9c, $9b
db $1c, $c3, $fc, $e0, $6a, $ac, $3d, $17
db $29, $b0, $69, $25, $85, $8e, $f4, $f1
db $5b, $92, $b1, $0e, $26, $40, $f3, $fa
db $3c, $90, $ec, $6b, $39, $64, $af, $70
db $fc, $25, $80, $9c, $96, $ad, $89, $01
db $c5, $e0, $77, $a4, $8a, $d1, $40, $f0
db $a4, $84, $10, $1e, $d9, $9f, $de, $22
db $3c, $2e, $2a, $aa, $6a, $7e, $67, $f5
db $23, $df, $3f, $20, $f7, $4c, $9a, $31
db $a7, $c7, $63, $e6, $82, $90, $70, $f3
db $a6, $02, $61, $86, $ff, $e8, $ee, $2b
db $a9, $eb, $92, $87, $60, $c2, $3b, $e8
db $38, $f1, $05, $51, $24, $e8, $ae, $c4
db $02, $30, $1b, $bd, $a4, $7f, $c9, $5e
db $8a, $01, $c8, $00, $90, $d0, $b8, $00
db $5d, $ba, $76, $bf, $fb, $91, $82, $b2
db $c6, $09, $46, $c9, $e4, $11, $48, $e5
db $fe, $d8, $9e, $e6, $1e, $10, $27, $ab
db $cb, $78, $ae, $f8, $00, $e9, $d5, $bc
db $99, $51, $ce, $9a, $3f, $8d, $0b, $e9
db $9f, $5c, $a3, $f5, $78, $80, $e6, $15
db $97, $21, $44, $17, $25, $8c, $5e, $cd
db $ba, $95, $d6, $6c, $92, $0d, $f4, $d8
db $23, $5d, $f1, $7c, $aa, $51, $fc, $c5
db $4b, $a5, $ab, $dc, $9e, $4d, $50, $ff
db $73, $c5, $44, $01, $e2, $ce, $42, $cd
db $f4, $9b, $ef, $8a, $6b, $66, $79, $f9
db $62, $fb, $54, $d8, $db, $bd, $a3, $d1
db $0c, $30, $ad, $d6, $28, $44, $35, $29
db $41, $41, $ed, $83, $79, $31, $4a, $b6
db $8b, $41, $22, $fa, $e3, $54, $54, $7c
db $b4, $86, $83, $ec, $fb, $4f, $90, $3b
db $7b, $43, $ce, $44, $7b, $92, $be, $73
db $ac, $26, $7a, $a6, $b9, $00, $29, $55
db $92, $9b, $1d, $f6, $1b, $ba, $77, $b7
db $00, $85, $38, $23, $b6, $29, $4e, $33
db $42, $f5, $5f, $99, $ef, $e4, $56, $90
db $fb, $b7, $50, $c8, $fe, $00, $9c, $ad
db $7f, $16, $0e, $6e, $80, $8b, $e1, $7a
db $3a, $72, $2f, $cf, $a8, $44, $45, $8a
db $af, $4a, $6c, $20, $27, $55, $69, $41
db $e1, $db, $30, $00, $f7, $4e, $4e, $fd
db $1e, $dc, $48, $7f, $80, $b6, $e6, $d5
db $9c, $cd, $9c, $ac, $92, $c5, $1f, $22
db $0d, $74, $da, $ec, $a1, $c9, $06, $17
db $b1, $ce, $b7, $fc, $80, $f6, $2b, $95
db $26, $44, $bf, $bb, $bd, $12, $8b, $0d
db $be, $30, $2d, $f4, $56, $0b, $39, $ec
db $70, $e3, $52, $9b, $23, $87, $e6, $a2
db $f9, $e7, $70, $84, $89, $52, $9f, $77
db $1e, $ba, $38, $e6, $55, $bd, $a6, $6b
db $34, $77, $eb, $a2, $5f, $c8, $98, $4f
db $47, $3b, $cb, $1b, $cd, $b6, $b7, $a2
db $c1, $a3, $da, $f2, $71, $72, $f7, $d9
db $cf, $db, $a3, $97, $59, $69, $10, $f6
db $cb, $f6, $16, $4a, $3d, $59, $98, $5a
db $b2, $4d, $57, $0c, $09, $e1, $d2, $b4
db $36, $f7, $e2, $86, $1d, $a9, $9c, $75
db $33, $04, $e4, $5b, $a2, $ca, $2b, $ce
db $f9, $1e, $59, $96, $af, $85, $6f, $a9
db $17, $a9, $9b, $f3, $f0, $4f, $f0, $c9
db $d0, $88, $b5, $15, $a3, $6d, $9d, $1b
db $6e, $66, $5c, $11, $5e, $4a, $dc, $b0
db $cb, $bb, $e7, $ea, $19, $11, $6e, $ce
db $11, $f8, $c0, $65, $15, $21, $9b, $90
db $bc, $43, $1a, $85, $0a, $27, $a8, $f2
db $2d, $39, $46, $41, $78, $4c, $22, $4a
db $bd, $4f, $d7, $90, $cf, $2c, $21, $17
db $9e, $c8, $02, $3f, $1a, $8d, $6e, $de
db $29, $9a, $9b, $0e, $68, $f1, $a7, $5e
db $01, $82, $9e, $2d, $f2, $0f, $33, $46
db $c8, $bf, $e6, $34, $36, $3f, $08, $24
db $83, $6e, $d9, $ee, $34, $db, $c3, $6f
db $ac, $3a, $88, $e2, $2d, $a4, $3a, $c1
db $66, $82, $3d, $83, $58, $f7, $5b, $c8
db $32, $a9, $76, $12, $aa, $8e, $59, $43
db $6b, $ef, $6b, $2f, $d9, $40, $5f, $b3
db $69, $15, $19, $5e, $0e, $ea, $ae, $cf
db $e6, $e7, $ee, $58, $ad, $4e, $3f, $e2
db $1a, $2a, $1b, $f6, $b2, $42, $93, $71
db $e9, $11, $10, $2e, $3a, $8f, $a8, $9f
db $47, $1f, $6c, $aa, $4d, $b8, $9a, $9a
db $4b, $6d, $ad, $2d, $3b, $51, $25, $50
db $19, $5e, $16, $5d, $35, $81, $8e, $c6
db $14, $86, $e2, $dd, $a5, $c4, $c0, $06
db $44, $e7, $04, $d0, $d8, $42, $57, $03
db $74, $e7, $e7, $e7, $fe, $82, $6a, $4c
db $40, $23, $50, $d0, $1b, $61, $3c, $ae
db $28, $f1, $30, $f8, $4e, $6b, $58, $35
db $95, $26, $99, $06, $76, $ab, $2d, $e3
db $72, $6f, $82, $71, $36, $fe, $df, $aa
db $53, $5d, $c5, $89, $5b, $a6, $82, $54
db $c1, $18, $20, $ea, $d9, $c7, $27, $96
db $25, $a5, $51, $6e, $18, $8e, $7e, $10
db $fb, $ba, $69, $7f, $ba, $22, $db, $f7
db $09, $9f, $71, $e8, $f8, $54, $4d, $36
db $d4, $05, $00, $7e, $23, $2b, $37, $71
db $99, $f1, $94, $4d, $78, $5e, $e7, $dd
db $1c, $17, $30, $df, $54, $9c, $bb, $e6
db $8f, $3a, $a0, $a5, $96, $54, $b6, $77
db $dc, $08, $ce, $79, $22, $68, $73, $3b
db $13, $4b, $92, $c5, $fa, $1e, $68, $ae
db $4b, $3e, $f0, $60, $42, $ba, $30, $43
db $65, $8e, $70, $5f, $96, $5d, $e9, $f9
db $97, $9d, $7d, $83, $a6, $c0, $ba, $31
db $2b, $e2, $26, $67, $56, $ef, $0b, $4d
db $8a, $2c, $ea, $5d, $22, $2c, $29, $c1
db $0b, $56, $ab, $36, $44, $c4, $90, $de
db $3a, $b1, $03, $68, $6e, $ae, $61, $ef
db $fd, $46, $74, $5c, $8c, $47, $2a, $4f
db $f4, $37, $80, $e3, $fa, $63, $70, $f1
db $63, $2a, $b5, $7e, $cc, $2d, $1f, $f9
db $de, $22, $61, $da, $bc, $28, $f0, $78
db $0a, $f9, $78, $3a, $3f, $02, $48, $ee
db $37, $0d, $c9, $71, $b4, $81, $8f, $e2
db $a7, $8e, $d2, $d8, $59, $e5, $b7, $3e
db $f6, $31, $c3, $78, $b6, $d5, $e0, $92
db $38, $4a, $e5, $9c, $cc, $05, $ff, $50
db $53, $1e, $f2, $68, $d6, $bb, $d7, $93
db $a3, $e2, $e9, $5d, $96, $12, $04, $97
db $af, $b5, $45, $00, $3d, $db, $56, $c5
db $0f, $59, $b6, $9c, $20, $96, $71, $70
db $34, $06, $0c, $f7, $b0, $22, $e4, $35
db $e7, $b9, $f4, $22, $92, $61, $80, $34
db $76, $71, $22, $66, $b1, $a1, $56, $44
db $fe, $55, $53, $6f, $bb, $24, $c6, $f5
db $d9, $44, $a0, $f8, $36, $99, $bf, $69
db $46, $b6, $3e, $2c, $8e, $f4, $d2, $10
db $d8, $a7, $86, $21, $2b, $ac, $c5, $60
db $e9, $fa, $fe, $85, $23, $b9, $3a, $7a
db $a2, $3a, $3f, $d0, $42, $7a, $4e, $61
db $8f, $41, $70, $95, $14, $c1, $a5, $a8
db $27, $fd, $91, $de, $3c, $d2, $60, $44
db $05, $de, $46, $83, $51, $2d, $74, $84
db $32, $6f, $ba, $7e, $d4, $7f, $dd, $e0
db $3f, $48, $2a, $f8, $ed, $5b, $77, $1a
db $fb, $e3, $18, $77, $46, $07, $13, $d3
db $94, $ba, $27, $85, $3d, $8a, $10, $2d
db $88, $2a, $ac, $a4, $4d, $27, $65, $0a
db $d1, $60, $38, $80, $0d, $76, $d8, $60
db $c9, $83, $fd, $9c, $69, $7f, $a5, $07
db $0f, $0c, $0c, $43, $ce, $bd, $f5, $37
db $54, $65, $76, $5b, $db, $b1, $79, $af
db $a8, $58, $7f, $b7, $99, $5b, $60, $10
db $72, $e2, $42, $cc, $d3, $41, $e3, $94
db $22, $23, $79, $07, $01, $d6, $26, $7f
db $99, $ee, $1b, $67, $c9, $4f, $a9, $1a
db $0f, $10, $47, $53, $90, $e8, $70, $e5
db $23, $b5, $1c, $89, $92, $df, $3f, $ed
db $0c, $2d, $4c, $26, $06, $d3, $88, $f9
db $89, $8f, $77, $5d, $96, $29, $75, $1e
db $23, $c3, $8b, $f4, $61, $c3, $f2, $3b
db $af, $16, $58, $d2, $fc, $1c, $98, $ca
db $b0, $a6, $1b, $00, $85, $15, $7a, $17
db $5a, $b5, $58, $09, $4a, $cb, $df, $86
db $08, $5b, $93, $38, $8e, $f6, $53, $e8
db $9c, $43, $be, $f0, $98, $7d, $a0, $51
db $c0, $6e, $36, $4a, $8f, $c0, $43, $80
db $e0, $c9, $ec, $47, $0c, $56, $87, $ca
db $68, $66, $d6, $8a, $51, $f3, $86, $35
db $14, $48, $b0, $55, $2a, $33, $65, $92
db $cd, $d5, $33, $32, $4f, $79, $b2, $3a
db $87, $ae, $47, $31, $95, $fe, $02, $8b
db $ad, $ec, $72, $32, $11, $c5, $2e, $dd
db $b3, $2e, $8b, $c8, $0f, $90, $45, $b7
db $0b, $bd, $f6, $4f, $65, $a3, $35, $36
db $0a, $cf, $a3, $13, $2a, $62, $db, $dc
db $3f, $10, $ff, $58, $46, $90, $eb, $1d
db $07, $63, $2f, $4c, $a9, $05, $7c, $14
db $1d, $ef, $06, $a2, $ec, $ba, $1d, $af
db $1f, $35, $54, $7c, $b1, $d5, $79, $d8
db $4b, $6d, $97, $a1, $d0, $90, $d8, $16
db $b8, $fb, $2b, $a3, $6a, $2a, $d5, $eb
db $3c, $0a, $32, $37, $b6, $06, $d1, $78
db $a5, $59, $45, $e5, $bc, $d3, $05, $9f
db $9c, $32, $c8, $c0, $8f, $9a, $0c, $97
db $34, $b8, $53, $3d, $98, $ce, $eb, $cc
db $1f, $7b, $e0, $87, $d6, $95, $fe, $0d
db $d9, $f2, $15, $fc, $66, $4a, $b4, $cc
db $8b, $90, $e1, $94, $3d, $85, $95, $ed
db $15, $82, $7c, $88, $0a, $e5, $e3, $c7
db $3c, $aa, $ce, $23, $6c, $21, $2b, $a4
db $88, $32, $58, $3f, $87, $9c, $60, $b3
db $06, $23, $fb, $b2, $b4, $4d, $e8, $f8
db $02, $3f, $b6, $31, $39, $49, $aa, $00
db $38, $2f, $1f, $3e, $2d, $c1, $18, $91
db $f7, $ac, $db, $ea, $54, $21, $39, $54
db $d8, $ed, $7e, $cf, $fd, $c8, $2f, $4e
db $4c, $6b, $62, $f6, $37, $5a, $21, $1d
db $03, $af, $b0, $54, $f6, $a8, $36, $24
db $c0, $5a, $1f, $fb, $52, $c4, $2d, $d9
db $99, $d0, $55, $82, $a1, $cf, $be, $ed
db $55, $af, $98, $ae, $4e, $ac, $4e, $9c
db $ef, $b9, $fa, $60, $1d, $3d, $7f, $c6
db $6b, $85, $45, $d4, $88, $90, $cf, $14
db $79, $09, $2c, $47, $29, $00, $e7, $e6
db $2c, $55, $c1, $ec, $fb, $ed, $22, $c6
db $aa, $d9, $26, $76, $4b, $1a, $05, $72
db $56, $33, $62, $12, $c7, $58, $20, $83
db $f7, $98, $ef, $68, $53, $ce, $59, $c1
db $da, $8f, $45, $32, $09, $c3, $f9, $86
db $df, $76, $d1, $32, $36, $15, $3c, $bd
db $79, $0c, $ca, $75, $53, $88, $a5, $6a
db $29, $95, $28, $5d, $5a, $47, $3c, $56
db $cc, $b6, $67, $4f, $ab, $9a, $0f, $26
db $2b, $94, $a8, $0f, $7d, $89, $dc, $b7
db $72, $60, $c0, $b5, $7f, $78, $2e, $d6
db $88, $75, $71, $41, $d3, $59, $c9, $f7
db $09, $c0, $25, $a0, $3a, $b4, $a3, $4f
db $7a, $aa, $97, $33, $7f, $1d, $56, $d1
db $d9, $37, $42, $36, $31, $3f, $e5, $82
db $bb, $25, $15, $1a, $9c, $46, $2f, $af
db $a9, $70, $c2, $6c, $ae, $ff, $4f, $bb
db $85, $c5, $46, $c9, $f8, $e0, $ea, $26
db $1d, $40, $4c, $ca, $4f, $20, $12, $35
db $87, $82, $f5, $62, $6e, $e1, $69, $20
db $85, $2b, $0c, $94, $6c, $cd, $af, $13
db $cf, $13, $9b, $0a, $79, $96, $03, $88
db $5a, $6f, $a6, $2a, $be, $8a, $62, $d2
db $0c, $ac, $93, $81, $78, $47, $ee, $2b
db $33, $d9, $d0, $09, $66, $da, $54, $e1
db $9d, $0f, $9f, $62, $67, $a3, $4f, $0a
db $8d, $ef, $8f, $b9, $e1, $be, $65, $ab
db $c4, $04, $f0, $1d, $2d, $0f, $7a, $68
db $c1, $f4, $7b, $f2, $dc, $48, $b0, $b4
db $23, $04, $6b, $a2, $30, $fa, $b6, $9a
db $7f, $9b, $27, $c9, $16, $a7, $53, $3f
db $55, $5c, $20, $9f, $fe, $3e, $35, $9a
db $2c, $ad, $88, $49, $33, $02, $67, $07
db $c3, $42, $49, $70, $71, $29, $73, $c9
db $f0, $32, $cc, $66, $dd, $bc, $9a, $24
db $b3, $70, $be, $56, $1a, $36, $20, $48
db $be, $6f, $4a, $bb, $fc, $dc, $a9, $b6
db $47, $6c, $a1, $f1, $06, $ef, $99, $4d
db $01, $86, $5b, $fe, $79, $cc, $60, $2c
db $79, $ca, $e4, $fd, $ab, $ee, $09, $a0
db $4f, $16, $d2, $b1, $62, $0e, $0d, $44
db $f5, $e7, $a0, $37, $df, $a0, $93, $7f
db $cf, $8a, $27, $ef, $db, $0b, $d8, $83
db $1e, $d7, $1e, $88, $f1, $a2, $e5, $e5
db $80, $25, $7b, $5c, $ce, $94, $86, $c9
db $57, $09, $c0, $cf, $65, $bf, $7c, $38
db $ef, $5e, $18, $89, $73, $79, $fe, $97
db $88, $45, $2f, $d7, $d0, $7a, $f0, $91
db $4e, $9f, $ec, $b9, $a8, $de, $77, $8a
db $e3, $b3, $9f, $1b, $7f, $b3, $94, $d0
db $df, $43, $b6, $4e, $a6, $42, $60, $c5
db $42, $51, $24, $55, $75, $b2, $35, $5e
db $0d, $83, $b8, $f7, $2d, $33, $68, $8e
db $3d, $86, $be, $48, $49, $28, $fe, $3d
db $cb, $33, $42, $c1, $cd, $aa, $80, $88
db $ce, $f8, $ed, $3c, $06, $76, $b5, $4a
db $67, $cb, $b4, $4a, $b9, $01, $1c, $36
db $16, $c7, $cb, $93, $8a, $f3, $33, $84
db $8a, $cf, $60, $4f, $4c, $c5, $9f, $ac
db $c8, $88, $df, $ec, $a4, $0f, $f5, $cc
db $ff, $cc, $bf, $94, $e0, $97, $50, $00
db $63, $f7, $99, $21, $2b, $e8, $cb, $3b
db $94, $62, $30, $c7, $4d, $c8, $27, $9e
db $77, $6a, $1b, $38, $81, $97, $8b, $0d
db $32, $40, $52, $22, $d7, $24, $e6, $43
db $80, $a1, $5d, $39, $19, $09, $95, $b8
db $a7, $07, $f6, $92, $d0, $03, $b7, $dc
db $db, $53, $87, $9f, $42, $e3, $d3, $86
db $51, $1d, $73, $c8, $bb, $d6, $6a, $62
db $d3, $26, $41, $03, $13, $a5, $cb, $79
db $a3, $1b, $1b, $50, $72, $63, $0f, $78
db $ab, $7a, $31, $27, $6a, $65, $00, $f4
db $c3, $b6, $ac, $f1, $16, $0d, $c5, $96
db $06, $83, $1b, $c5, $fd, $2e, $8c, $6a
db $f3, $da, $d4, $75, $bb, $82, $06, $ca
db $57, $46, $f2, $3f, $87, $c6, $2d, $89
db $23, $a2, $80, $9a, $aa, $95, $76, $a0
db $45, $98, $03, $ce, $3c, $ae, $b4, $3d
db $36, $dd, $e8, $83, $c7, $64, $c8, $6c
db $ef, $4b, $b5, $7f, $35, $87, $37, $59
db $55, $00, $c2, $b3, $62, $f7, $ab, $df
db $8c, $47, $ba, $67, $04, $1a, $dc, $36
db $24, $e1, $9d, $c3, $47, $bc, $c9, $3b
db $80, $e5, $a8, $f0, $6c, $f9, $43, $af
db $e5, $13, $2d, $3f, $fe, $08, $7c, $75
db $d4, $f5, $17, $b4, $e7, $89, $81, $84
db $00, $ca, $cd, $fe, $f1, $68, $09, $55
db $19, $25, $a2, $c8, $f9, $07, $1c, $2a
db $50, $28, $3e, $68, $50, $fa, $6d, $b4
db $79, $23, $be, $0b, $eb, $2a, $ec, $e2
db $fc, $f2, $e9, $03, $e0, $cd, $e3, $cc
db $f1, $ab, $9d, $51, $28, $48, $34, $53
db $db, $32, $52, $88, $4b, $7d, $37, $8e
db $db, $3c, $3c, $8f, $28, $33, $d9, $ae
db $5e, $db, $5d, $b2, $17, $7a, $c2, $0a
db $c2, $49, $a9, $ef, $56, $78, $bf, $ac
db $c2, $ae, $2b, $d6, $4e, $4f, $6d, $af
db $5c, $1b, $40, $c4, $2b, $13, $5c, $55
db $be, $33, $ba, $63, $38, $c0, $b5, $6b
db $45, $77, $b1, $46, $5a, $b4, $3e, $4b
db $92, $94, $93, $d4, $4d, $5f, $82, $46
db $00, $72, $aa, $7b, $8b, $cf, $86, $db
db $16, $2e, $68, $8a, $68, $41, $34, $23
db $56, $77, $27, $b2, $49, $42, $91, $57
db $5e, $e1, $1e, $e7, $aa, $8c, $7b, $99
db $53, $8b, $a6, $b5, $b1, $b2, $ac, $a1
db $ef, $ce, $35, $8f, $25, $d6, $96, $72
db $9c, $3f, $d7, $c4, $bf, $fe, $8c, $4c
db $da, $d2, $ce, $05, $70, $ae, $63, $76
db $12, $26, $3d, $88, $78, $43, $a4, $7b
db $e9, $ec, $34, $d3, $ee, $71, $10, $84
db $1f, $b8, $40, $b8, $da, $f3, $15, $63
db $83, $7e, $49, $18, $0c, $8e, $17, $5e
db $b6, $22, $90, $cf, $ec, $85, $40, $89
db $1a, $c6, $a2, $49, $2e, $77, $a8, $d4
db $9b, $9b, $d8, $bd, $8c, $40, $21, $56
db $6f, $6d, $cd, $9b, $5b, $cd, $92, $ac
db $ad, $a2, $b6, $64, $59, $c7, $8c, $44
db $ad, $c8, $14, $dd, $bc, $21, $8e, $9e
db $a0, $6e, $6a, $07, $8c, $0e, $66, $3a
db $55, $52, $3c, $2b, $40, $5f, $3f, $11
db $f8, $9b, $ce, $89, $ea, $d4, $b8, $1b
db $52, $72, $dd, $86, $a4, $13, $5c, $d8
db $f4, $f6, $69, $bf, $30, $6c, $14, $8d
db $66, $27, $da, $d7, $7b, $1f, $8a, $8b
db $ca, $c0, $fd, $40, $fe, $cb, $97, $74
db $05, $22, $ea, $3f, $38, $92, $3b, $8a
db $50, $5b, $06, $3b, $a4, $97, $ad, $95
db $03, $3e, $26, $47, $b6, $2d, $19, $80
db $68, $28, $2b, $e0, $cf, $8a, $97, $ba
db $9b, $1c, $de, $b2, $bd, $48, $65, $46
db $c6, $ff, $76, $ae, $84, $35, $89, $82
db $f7, $d6, $f3, $53, $d4, $2d, $db, $0b
db $fa, $94, $f4, $35, $56, $f3, $6e, $38
db $ae, $02, $f7, $6b, $19, $06, $5c, $8b
db $f1, $61, $f7, $28, $ea, $d5, $fa, $ca
db $c3, $f9, $a3, $60, $ea, $db, $cf, $c3
db $f0, $b1, $6f, $ba, $3b, $02, $99, $be
db $46, $f9, $77, $37, $7b, $9f, $5b, $62
db $35, $05, $f6, $77, $1e, $c9, $c5, $f5
db $11, $d9, $17, $8f, $32, $19, $4d, $ec
db $3a, $20, $b8, $0f, $70, $4a, $68, $76
db $14, $01, $6c, $28, $9b, $f5, $b7, $af
db $80, $ba, $56, $89, $1c, $0a, $22, $cc
db $b1, $f2, $50, $e2, $be, $79, $c6, $e5
db $68, $9a, $71, $f4, $1d, $f8, $93, $e4
db $0e, $df, $72, $bd, $05, $e0, $4a, $c7
db $45, $57, $7a, $3b, $87, $98, $6a, $73
db $c6, $9c, $d7, $3f, $52, $da, $15, $3d
db $4f, $71, $c8, $24, $61, $a0, $6f, $1a
db $65, $13, $e0, $f4, $02, $ea, $c6, $6d
db $bb, $2d, $2e, $e6, $c4, $b5, $ae, $7e
db $e5, $57, $cf, $c0, $00, $21, $4c, $3b
db $5e, $fb, $22, $6a, $22, $28, $22, $b4
db $0a, $c2, $9b, $62, $4d, $49, $7c, $6e
db $53, $9f, $6a, $59, $d4, $27, $9b, $9d
db $fc, $f4, $7b, $1f, $96, $60, $17, $32
db $be, $d8, $ae, $3a, $ce, $97, $79, $cf
db $a8, $8d, $15, $cd, $ef, $cc, $98, $8a
db $60, $3d, $d3, $bf, $cd, $86, $c3, $22
db $b5, $27, $e5, $1c, $c1, $c6, $cf, $98
db $81, $e3, $6e, $f6, $e2, $2d, $3a, $f1
db $76, $2e, $2d, $ed, $42, $d1, $0f, $c1
db $11, $7e, $88, $f2, $8f, $a8, $74, $f3
db $32, $3e, $c4, $db, $68, $2a, $d2, $e0
db $ea, $78, $e5, $64, $8b, $48, $7d, $98
db $3d, $f6, $bb, $09, $fe, $5a, $5c, $9d
db $07, $41, $90, $f0, $11, $29, $be, $05
db $23, $0d, $73, $cb, $6c, $12, $4d, $15
db $6b, $2d, $4c, $9a, $58, $77, $cd, $89
db $e9, $84, $3a, $f7, $6a, $1b, $3b, $df
db $63, $11, $fd, $68, $c4, $b6, $5e, $59
db $41, $b8, $d3, $b3, $38, $32, $c2, $89
db $e7, $50, $d2, $f9, $96, $15, $51, $5e
db $90, $68, $0e, $e6, $62, $0d, $07, $fd
db $2a, $c5, $e7, $53, $62, $23, $d9, $1d
db $03, $ac, $16, $63, $05, $27, $d9, $4a
db $22, $b1, $96, $d3, $03, $9b, $32, $c9
db $82, $d9, $fc, $6a, $22, $9f, $8e, $ed
db $10, $59, $7c, $e9, $f5, $fc, $8d, $9a
db $67, $27, $fa, $da, $49, $cc, $de, $74
db $15, $60, $3d, $4c, $32, $bb, $40, $8c
db $c5, $c7, $a5, $13, $7e, $e0, $2f, $fe
db $85, $bb, $40, $68, $c4, $ff, $0a, $bb
db $bf, $97, $70, $5c, $c9, $5b, $9e, $4a
db $19, $2f, $e5, $b5, $29, $b1, $9f, $8e
db $92, $e5, $b8, $66, $68, $7a, $2f, $70
db $b9, $02, $c6, $1a, $bb, $02, $e6, $32
db $98, $a3, $84, $e6, $47, $99, $e8, $ec
db $a4, $9d, $02, $a4, $60, $b8, $88, $03
db $c6, $89, $fa, $52, $8e, $30, $4a, $3c
db $ef, $e9, $cb, $80, $c2, $1f, $64, $55
db $19, $ed, $ec, $44, $c8, $0e, $4e, $2a
db $d4, $b5, $a9, $fe, $49, $2f, $07, $9c
db $30, $79, $fc, $fc, $40, $ef, $7c, $88
db $70, $24, $7a, $49, $bb, $f0, $0b, $3d
db $a6, $38, $d9, $63, $08, $04, $0f, $2c
db $c3, $bf, $2d, $6f, $3f, $3d, $82, $97
db $05, $78, $00, $27, $b4, $12, $1a, $7f
db $d0, $2b, $d7, $6c, $4e, $fd, $5c, $4e
db $38, $91, $14, $12, $a1, $b9, $48, $0d
db $24, $36, $d6, $d4, $5d, $ae, $3c, $c4
db $d0, $5a, $9f, $b9, $8a, $52, $9a, $2e
db $3d, $b3, $49, $68, $4e, $60, $f0, $e2
db $eb, $9a, $00, $98, $42, $c4, $50, $8d
db $4f, $96, $0f, $2c, $c7, $1e, $cc, $fd
db $20, $7e, $20, $a3, $9a, $bb, $b7, $b9
db $94, $37, $82, $61, $da, $21, $39, $e8
db $65, $90, $bc, $7d, $c3, $2c, $ed, $17
db $f0, $67, $cb, $01, $b0, $96, $1d, $df
db $a0, $62, $80, $35, $5e, $8c, $a5, $1f
db $77, $53, $06, $3a, $d3, $a4, $96, $79
db $45, $a1, $d6, $1e, $37, $dd, $14, $6f
db $ed, $f8, $c0, $a2, $6c, $90, $29, $2c
db $19, $cc, $ca, $83, $1d, $92, $75, $c5
; pseudo random data ends
; Zero page addresses
cc = $00 ; start of 16 byte buffer holding check code
pp = $10 ; 2-byte pointer to page to work on
bk = $12 ; 1-byte number of block to work on
; And now the program.
* = PBASE
; hextbl: A table mapping values 0-15 to their corresponding hex
; digits.
hextbl = *
asc "0123456789abcdef"
; txchar: transmit a character on the serial port, without using
; interrupts. The character is in the accumulator; doesn't alter
; any registers.
txchar = *
pha ; stash the byte value for later
txchar__loop = *
lda ICTL_PEB1
ror a ; get bit 0 into carry, indicating port 8 is ready for write
bcc txchar__loop ; not ready
pla
sta SER_BASE+SER_TX ; write the byte to port 8
rts ; done
; txhex: transmit a byte (in accumulator) in two hexadecimal digits.
; Also messes with the 'X' register.
txhex = *
pha ; stash the byte for later use
lsr a ; extract the upper 4 bits
lsr a
lsr a
lsr a
tax ; and look up the hex digit
lda hextbl, x
jsr txchar ; and print it
pla ; now get the lower 4 bits
and #15
tax ; and look up the hex digit
lda hextbl, x
jsr txchar ; and print it
rts ; and done
start = *
; no interrupts, we don't use them
sei
; initialize serial port on slot 8 to 9600 baud
lda #$15 ; code for 9600 baud
sta SER_BASE+SER_TA
sta SER_BASE+SER_RA
lda #$30
sta SER_BASE+SER_TB ; set to 8n2 (compatible with 8n1)
lda #$20
sta SER_BASE+SER_RB ; set to 8n1
; compute the check code byte by byte starting from the right
ldx #15
cc_loop = *
stx LEDOUT ; indicate on LEDs how many are left
jsr mkcheck ; compute this byte of the check code
dex ; next byte
bpl cc_loop ; repeat as long as x >= 0
; done computing the check code, now just keep printing it out
txloop = *
inc LEDOUT ; count lines on the LEDs
lda cc
jsr txhex
lda cc+1
jsr txhex
lda cc+2
jsr txhex
lda cc+3
jsr txhex
lda cc+4
jsr txhex
lda cc+5
jsr txhex
lda cc+6
jsr txhex
lda cc+7
jsr txhex
lda cc+8
jsr txhex
lda cc+9
jsr txhex
lda cc+10
jsr txhex
lda cc+11
jsr txhex
lda cc+12
jsr txhex
lda cc+13
jsr txhex
lda cc+14
jsr txhex
lda cc+15
jsr txhex
lda #13
jsr txchar
lda #10
jsr txchar
jmp txloop
; mkcheck - make a single byte of check code, pointed to by X
mkcheck = *
txa
sta cc,x ; initialize the check code
lda #D1BASE>>8
sta bk
jsr bkcheck
lda #D2BASE>>8
sta bk
jsr bkcheck
lda #D3BASE>>8
sta bk
jsr bkcheck
lda #D4BASE>>8
sta bk
jsr bkcheck
lda #D5BASE>>8
sta bk
jsr bkcheck
lda #D6BASE>>8
sta bk
jsr bkcheck
rts
; bkcheck - update a byte of check code (pointed to by X) with 4kB
; of data starting at address (bk)*256
bkcheck = *
lda bk
sta pp+1
lda #0
sta pp
jsr pgcheck
inc pp+1
jsr pgcheck
inc pp+1
jsr pgcheck
inc pp+1
jsr pgcheck
inc pp+1
jsr pgcheck
inc pp+1
jsr pgcheck
inc pp+1
jsr pgcheck
inc pp+1
jsr pgcheck
inc pp+1
jsr pgcheck
inc pp+1
jsr pgcheck
inc pp+1
jsr pgcheck
inc pp+1
jsr pgcheck
inc pp+1
jsr pgcheck
inc pp+1
jsr pgcheck
inc pp+1
jsr pgcheck
inc pp+1
jsr pgcheck
rts
; pgcheck - update a byte of check code (pointed to by X) with 256
; bytes of data starting at address (pp)
pgcheck = *
ldy #0 ; index & byte counter
pgcheck__loop = *
lda (pp),y ; get the next byte
clc
adc cc,x ; this is twos complement addition
adc #0 ; making it ones complement by putting carry back in
sta cc,x ; storing the result temporary
ror a ; and rotating right one bit
ror cc,x
iny ; and going on to the next data byte
bne pgcheck__loop ; if there are any
rts ; if not, done
* = $fffc
dw start ; reset vector
|
; A057682: a(n) = Sum_{j=0..floor(n/3)} (-1)^j*binomial(n,3*j+1).
; 0,1,2,3,3,0,-9,-27,-54,-81,-81,0,243,729,1458,2187,2187,0,-6561,-19683,-39366,-59049,-59049,0,177147,531441,1062882,1594323,1594323,0,-4782969,-14348907,-28697814,-43046721,-43046721,0,129140163,387420489,774840978,1162261467,1162261467,0,-3486784401,-10460353203,-20920706406,-31381059609,-31381059609,0,94143178827,282429536481,564859072962,847288609443,847288609443,0,-2541865828329,-7625597484987,-15251194969974,-22876792454961,-22876792454961,0,68630377364883,205891132094649,411782264189298
mov $2,2
lpb $0
sub $0,1
mov $1,$2
add $3,$2
mul $2,3
sub $2,$3
lpe
div $1,2
mov $0,$1
|
; char *_memupr__callee(void *p, size_t n)
SECTION code_clib
SECTION code_string
PUBLIC __memupr__callee
EXTERN asm__memupr
__memupr__callee:
pop af
pop hl
pop bc
push af
jp asm__memupr
|
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1991 -- All Rights Reserved
PROJECT: DOS Primary IFS Drivers
MODULE: Disk Copying
FILE: driDiskCopy.asm
AUTHOR: Adam de Boor, Oct 31, 1991
ROUTINES:
Name Description
---- -----------
REVISION HISTORY:
Name Date Description
---- ---- -----------
Adam 10/31/91 Initial revision
DESCRIPTION:
Implementation of disk copying.
$Id: dosDiskCopy.asm,v 1.1 97/04/10 11:55:05 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DiskCopyCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOSDiskCopyLockInfoShared
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Lock the FSIR for shared access and remember it's locked
CALLED BY: (INTERNAL)
PASS: ds = DiskCopyData
RETURN: es = FSInfoResource
DESTROYED: nothing
SIDE EFFECTS: ds:[DCD_status].DCS_FSIR_LOCKED set
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 11/ 8/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOSDiskCopyLockInfoShared proc near
uses ax
.enter
call FSDLockInfoShared
mov es, ax
ornf ds:[DCD_status], mask DCS_FSIR_LOCKED
.leave
ret
DOSDiskCopyLockInfoShared endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOSDiskCopyUnlockInfoShared
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Release shared access to the FSIR and remember it's no
longer locked
CALLED BY: (INTERNAL)
PASS: ds = DiskCopyData
RETURN: nothing
DESTROYED: nothing (flags preserved)
SIDE EFFECTS: ds:[DCD_status].DCS_FSIR_LOCKED cleared
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 11/ 8/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOSDiskCopyUnlockInfoShared proc near
.enter
pushf
EC < test ds:[DCD_status], mask DCS_FSIR_LOCKED >
EC < ERROR_Z GASP_CHOKE_WHEEZE >
call FSDUnlockInfoShared
andnf ds:[DCD_status], not mask DCS_FSIR_LOCKED
popf
.leave
ret
DOSDiskCopyUnlockInfoShared endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOSDiskCopy
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Copy an entire disk from one drive to another (or the same
drive, actually)
CALLED BY: DR_FS_DISK_COPY
PASS: ss:bx = FSCopyArgs
RETURN: carry set on error:
ax = FormatError/DiskCopyError
carry clear on success:
ax = 0
DESTROYED: di, bp
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 10/31/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOSDiskCopy proc far
uses bx, cx, dx, si, ds, es
.enter
;
; Allocate the workspace we need. This copies the FSCopyArgs in
;
call DOSDiskCopyAllocWorkspace
jc exit
;
; Lock the two drives for exclusive access. Sets DCD_status,
; DCD_realSource, and DCD_realDest, coping with drive aliases
;
call DOSDiskCopyLockDrives
;
; Lock the source disk in its drive. This should just be a formality,
; but it's good to be safe. Who knows what auto-save might have done
; before we could lock the drive.
;
call DOSDiskCopyLockInfoShared
mov si, ds:[DCD_args].FSCA_disk
clr al ; lock abort allowed
call DOSDiskLock
mov ax, ERR_OPERATION_CANCELLED
jc cleanup
;
; Make sure we are using the right physical source drive
; (the disk lock above asserts the logical source drive
; if it is an alias)
;
mov di, ds:[DCD_realSource]
cmp di, ds:[DCD_args].FSCA_source
je notAlias
clr bx
mov bl, es:[di].DSE_number ; bx = physical drive number
inc bx ; 1-based
mov ax, MSDOS_SET_LOGICAL_DRIVE_MAP
call DOSUtilInt21
notAlias:
;
; Read the boot sector in to get the actual disk geometry, rather
; than relying on our tables.
; Initializes DCD_bpb, DCD_numClusters, DCD_clusterSize, DCD_bufferSize,
; DCD_rootDirSize
;
call DOSDiskCopyGetDiskGeometry
jc cleanup
;
; Read in the FAT of the source disk and figure how many used clusters
; there are on the disk. This will govern how much stuff we allocate
;
call DOSDiskCopyReadSourceFAT
jc cleanup
;
; Release the FSIR before we try to allocate the buffers.
;
call DOSDiskCopyUnlockInfoShared
;
; Allocate all the buffers we'll need or are willing to allow ourselves.
;
call DOSDiskCopyAllocBuffers
jc cleanup
;
; Now loop, reading and writing things.
;
call DOSDiskCopyCopyDisk
cleanup:
call DOSDiskCopyCleanUp
exit:
.leave
ret
DOSDiskCopy endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOSDiskCopyAllocWorkspace
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Allocate room in which we can work.
CALLED BY: (INTERNAL) DOSDiskCopy
PASS: ss:bx = FSCopyArgs
RETURN: carry set on error:
ax = DiskCopyError
ds = preserved
carry clear on success:
ds = DiskCopyData
ax = destroyed
DESTROYED: bx, ax, cx, si, di, es
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 11/ 8/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOSDiskCopyAllocWorkspace proc near
.enter
;
; Try and allocate the room we need. No point in allocating it
; dynamic, as we need it locked the entire time. Do initialize it
; to zero, though.
;
mov si, bx
mov ax, size DiskCopyData
mov cx, ALLOC_FIXED or (mask HAF_ZERO_INIT shl 8)
call MemAlloc
jc noMem
;
; Copy the FSCopyArgs into the workspace after saving its handle
; away.
;
mov es, ax
mov es:[DCD_handle], bx
segmov ds, ss
mov di, offset DCD_args
mov cx, size FSCopyArgs
rep movsb
mov ds, ax ; ds <- workspace
done:
.leave
ret
noMem:
mov ax, ERR_DISKCOPY_INSUFFICIENT_MEM
jmp done
DOSDiskCopyAllocWorkspace endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOSDiskCopyLockDrives
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Lock both drives for exclusive access, being careful
of aliases.
CALLED BY: (INTERNAL) DOSDiskCopy
PASS: ds = DiskCopyData
RETURN: ds:[DCD_status], ds:[DCD_realSource], ds:[DCD_realDest]
DESTROYED: es, ax, si, di
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 11/ 8/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOSDiskCopyLockDrives proc near
.enter
call DOSDiskCopyLockInfoShared
mov si, ds:[DCD_args].FSCA_source
mov di, ds:[DCD_args].FSCA_dest
;
; Lock both drives. Because any alias lock is a thread lock, not a
; semaphore, we don't need to worry about deadlocking on ourselves.
; XXX: Perhaps we ought to do this in the kernel, then...
;
call FSDLockDriveExcl
xchg si, di
cmp si, di
je haveRealSourceAndDest
call FSDLockDriveExcl
;
; Now deal with the two drives being an alias for the same physical
; drive. We can check this by comparing their DDPD_aliasLock fields.
; If they match, they are really the same drive. If either drive
; is managed by some FSD other than us, we don't worry about
; aliases.
;
mov bx, es:[si].DSE_fsd
cmp es:[bx].FSD_handle, handle 0
jne haveRealSourceAndDest
mov bx, es:[si].DSE_private ; bx <- dst drive
; private data
tst bx
jz haveRealSourceAndDest
mov ax, es:[bx].DDPD_aliasLock
mov bx, es:[di].DSE_fsd
cmp es:[bx].FSD_handle, handle 0
jne haveRealSourceAndDest
mov bx, es:[di].DSE_private ; bx <- src drive
; private data
tst bx
jz haveRealSourceAndDest
cmp ax, es:[bx].DDPD_aliasLock ; same drive?
jne haveRealSourceAndDest ; no
tst ax ; is either an alias?
jz haveRealSourceAndDest ; no
;
; Use the one whose number is the physical drive, so we can use BIOS
; when we need to. We assume the one with the lower number is the actual
; drive.
;
mov bl, es:[di].DSE_number ; bl <- src drive #
cmp bl, es:[si].DSE_number ; lower than dest?
jb setAliasDrive ; yes
xchg di, si
mov bl, es:[di].DSE_number
setAliasDrive:
;
; es:di = physical drive
; bl = physical drive #
; Tell DOS of our choice.
;
clr bh
inc bx ; 1-origin
mov ax, MSDOS_SET_LOGICAL_DRIVE_MAP
call DOSUtilInt21
mov si, di ; make realDest match realSource
haveRealSourceAndDest:
;
; Store the DCD_realSource and DCD_realDest values upon which we've
; decided.
;
mov ds:[DCD_realSource], di
mov ds:[DCD_realDest], si
;
; If they're the same drive, set DCS_SINGLE_DRIVE in DCD_status
;
mov al, mask DCS_DRIVES_LOCKED or mask DCS_FSIR_LOCKED
cmp si, di
jne setStatus
ornf al, mask DCS_SINGLE_DRIVE
setStatus:
mov ds:[DCD_status], al
call DOSDiskCopyUnlockInfoShared
.leave
ret
DOSDiskCopyLockDrives endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOSDiskCopyGetDiskGeometry
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Read the boot sector for the source disk and calculate the
geometry of the disk.
CALLED BY: (INTERNAL) DOSDiskCopy
PASS: ds = DiskCopyData
es = FSInfoResource
RETURN: carry set on error:
ax = DiskCopyError
carry clear if ok:
ax = destroyed
ds:[DCD_bpb], ds:[DCD_numClusters],
ds:[DCD_clusterSize], ds:[DCD_bufferSize], and
ds:[DCD_rootDirSize], ds:[DCD_startFiles],
ds:[DCD_fatSize] set
DESTROYED: ax, bx, cx, dx, si, di, es
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 11/ 8/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOSDiskCopyGetDiskGeometry proc near
.enter
;
; Read the boot sector for the disk.
;
mov si, ds:[DCD_realSource]
push ds
call DOSDiskReadBootSectorFar
pop es
jc fail
;
; Copy the BiosParamBlock from the boot sector to our storage area.
;
mov si, offset BS_bpbSectorSize
mov cx, size BiosParamBlock
mov di, offset DCD_bpb
rep movsb
call DOSDiskReleaseBootSector
segmov ds, es ; ds <- DiskCopyData again
;
; Now calculate things. First figure the number of bytes in the
; root directory.
;
mov ax, size RootDirEntry
mul ds:[DCD_bpb].BPB_numRootDirEntries
mov ds:[DCD_rootDirSize], ax
;
; Use that to calculate the number of sectors in the root dir so we
; can figure the start of the files area.
;
div ds:[DCD_bpb].BPB_sectorSize
tst dx
jz haveNumRootDirSectors
inc ax
haveNumRootDirSectors:
add ax, ds:[DCD_bpb].BPB_numReservedSectors
mov_tr cx, ax ; save root dir + boot #
mov ax, ds:[DCD_bpb].BPB_sectorsPerFAT
mov dl, ds:[DCD_bpb].BPB_numFATs
clr dh
mul dx ; dxax <- # FAT sectors
add ax, cx ; ax <- # non-files sectors
mov ds:[DCD_startFiles], ax
;
; Figure the size of a cylinder in bytes so we can set it as the
; buffer size to use.
;
mov ax, ds:[DCD_bpb].BPB_sectorSize
mul ds:[DCD_bpb].BPB_sectorsPerTrack
mul ds:[DCD_bpb].BPB_numHeads
mov ds:[DCD_bufferSize], ax
;
; Figure the size of a cluster, in bytes.
;
mov al, ds:[DCD_bpb].BPB_clusterSize
clr ah
mov cx, ax ; save cluster size
; for figuring # clust
mul ds:[DCD_bpb].BPB_sectorSize
mov ds:[DCD_clusterSize], ax
;
; Figure the number of clusters on the disk.
;
mov ax, ds:[DCD_bpb].BPB_numSectors
sub ax, ds:[DCD_startFiles] ; ax <- # sectors for files
clr dx
div cx ; ax <- # clusters (no
; rounding, as any partial
; cluster at the end can't be
; used as a cluster)
inc ax ; account for 2 reserved clusters
inc ax ; at the very start
mov ds:[DCD_numClusters], ax
;
; Decide if it uses a 12-bit or 16-bit FAT, based on the number of
; clusters on the disk. Set DCD_fatSize to 4 (number of bits for right
; shift on odd clusters) if 12-bit.
;
cmp ax, FAT_16_BIT_THRESHOLD
jae done ; DCD zero-initialized, so
; just leave DCD_fatSize alone
mov ds:[DCD_fatSize], 4
clc
done:
.leave
ret
fail:
segmov ds, es ; ds <- DiskCopyData again
mov ax, ERR_CANT_READ_FROM_SOURCE
jmp done
DOSDiskCopyGetDiskGeometry endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOSDiskCopyReadSourceFAT
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Read the first FAT for the source disk into memory.
CALLED BY: (INTERNAL) DOSDiskCopy
PASS: ds = DiskCopyData
RETURN: carry set on error:
ax = DiskCopyError
carry clear if ok:
ax = destroyed
ds:[DCD_numUsedClust], ds:[DCD_fatBuffer] initialized
DESTROYED: bx, cx, dx, si, di, es
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 11/ 8/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOSDiskCopyReadSourceFAT proc near
.enter
;
; Get the FSIR back again.
;
call FSDDerefInfo
mov es, ax
mov si, ds:[DCD_realSource] ; ds:si <- drive from which
; to read
;
; Allocate room for the entire FAT for both the source and the dest
; disks.
;
mov ax, ds:[DCD_bpb].BPB_sectorsPerFAT
mul ds:[DCD_bpb].BPB_sectorSize
mov ds:[DCD_destFATOff], ax
shl ax ; *2, of course
mov cx, ALLOC_DYNAMIC_LOCK
call MemAlloc
jc allocError
;
; Read the whole thing into memory.
;
mov ds:[DCD_fatBuffer], bx
push ds
mov dx, ds:[DCD_bpb].BPB_numReservedSectors
clr bx
mov cx, ds:[DCD_bpb].BPB_sectorsPerFAT
clr di
mov ds, ax
call DOSReadSectors
pop es ; es <- DCD
jc readError
;
; Now count the number of clusters in-use. During the loop:
; cl = value by which to right-shift to get cluster
; value. Toggles between 0 and 4 for 12-bit FAT,
; always 0 for 16-bit
; dx = FAT_CLUSTER_BAD for the FAT size, used to get only
; the proper bits, and to see if the thing is really
; used or just bad (see DOSDiskCopyProcessClusters for
; an explanation)
; ds:si = word in the FAT to examine
; di = # clusters left to process
; es = DiskCopyData
;
;
mov di, es:[DCD_numClusters]
dec di ; don't count first 2
dec di ; reserved clusters
clr cl
mov dx, FAT_CLUSTER_BAD ; assume 16-bit FAT
mov si, 4 ; ditto
tst es:[DCD_fatSize]
jz clusterLoop
dec si ; 12-bit FAT, so first file
; entry is at 3, not 4
mov dh, 0x0f ; mask out top 4 bits
clusterLoop:
lodsw ; ax <- next FAT entry
shr ax, cl ; right-justify
test ax, 8 ; neither free nor bad?
jnz isUsed ; right, must be used
and ax, dx ; mask out unwanted bits
jz nextCluster ; => free
cmp ax, dx ; bad?
je nextCluster ; yes
isUsed:
inc es:[DCD_numUsedClust] ; up count
nextCluster:
dec di
jz clusterLoopDone
xor cl, es:[DCD_fatSize] ; flip fat-entry toggle
jz clusterLoop ; => advance of si by 2 was
; right
dec si ; only wanted one, thanks
jmp clusterLoop
clusterLoopDone:
clc
unlockFAT:
;
; Have the count of used clusters now, so unlock the FAT.
;
segmov ds, es ; ds <- DiskCopyData again
add ds:[DCD_numUsedClust], 2; account for boot sector and
; root dir "clusters" (also
; prevents death when copying
; empty disk...)
mov bx, ds:[DCD_fatBuffer]
call MemUnlock
done:
.leave
ret
allocError:
mov ax, ERR_DISKCOPY_INSUFFICIENT_MEM
jmp done
readError:
mov ax, ERR_CANT_READ_FROM_SOURCE
jmp unlockFAT
DOSDiskCopyReadSourceFAT endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOSDiskCopyAllocBuffers
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Allocate as many buffers as we, the user, and the system
will allow us to allocate.
CALLED BY: (INTERNAL) DOSDiskCopy
PASS: ds = DiskCopyData
RETURN: carry set if couldn't allocate any buffers
DESTROYED: ax, bx, cx, dx
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 11/ 6/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOSDiskCopyAllocBuffers proc near
.enter
;
; Figure how many buffers we'd need to hold everything.
;
mov ax, ds:[DCD_numUsedClust]
mul ds:[DCD_clusterSize]
add ax, ds:[DCD_rootDirSize]
adc dx, 0
mov cx, ds:[DCD_bufferSize] ; cx <- cylinder size
dec cx ; round up...
add ax, cx
adc dx, 0
inc cx ; back to cylinder size...
div cx ; ax <- # cylinder buffers
; required (remainder
; unimportant)
if _REDMS4
mov dx, DISK_COPY_SINGLE_DRIVE_REDWOOD_BUFFER_LIMIT
else
;
; Figure how many we'll allow ourselves to allocate, if the system
; will let us.
;
; For a multi-drive copy, we use a predefined max,
; regardless of the DCF_GREEDY flag, as there's no need to be
; greedy during the copy (it won't gain us anything).
;
; For a single-drive, non-greedy copy, we use a higher predefined max,
; to limit the number of swaps.
;
; For a single-drive, greedy copy, we use as many as we've decided
; we'll need.
;
mov dx, DISK_COPY_MULTI_DRIVE_BUFFER_LIMIT
test ds:[DCD_status], mask DCS_SINGLE_DRIVE
jz allocLoop
mov dx, DISK_COPY_SINGLE_DRIVE_NON_GREEDY_BUFFER_LIMIT
test ds:[DCD_args].FSCA_flags, mask DCF_GREEDY
jz allocLoop
mov dx, ax
endif
allocLoop:
;
; Try and allocate another buffer of the chosen size. Do not need it
; locked or anything (in fact, we definitely do not want it locked).
;
mov ax, ds:[DCD_bufferSize]
mov cx, ALLOC_DYNAMIC
call MemAlloc
jc allocDone
;
; Link the previous firstBuffer to this new one through the otherInfo
; field.
;
mov ax, ds:[DCD_firstBuffer]
call MemModifyOtherInfo
;
; Store the new handle and up the number of buffers. If more to allocate
; do so, s'il vous plais.
;
mov ds:[DCD_firstBuffer], bx
inc ds:[DCD_numBuffers]
dec dx
jnz allocLoop
allocDone:
;
; Count the number of disk swaps that will be required, if this is
; a single-disk copy, and tell the user this.
;
test ds:[DCD_status], mask DCS_SINGLE_DRIVE
jz checkAnythingAllocated
mov cx, ds:[DCD_numBuffers]
jcxz nothingAllocated
mov ax, -1
mov di, offset DOSDiskCopyCountSwapCallback
call DOSDiskCopyProcessDisk
;
; Take the number of times DOSDiskCopyCountSwapCallback was called,
; being the number of buffers that will be filled during the
; copy, and divide by the number of buffers we were able to allocate
; (which we know is non-zero), rounding up if there's any remainder.
; This gives us the number of disk swaps that will be needed.
;
mov ax, ds:[DCD_numSwaps]
clr dx ; zero-extend
div ds:[DCD_numBuffers]
tst dx ; remainder?
jz haveNumSwaps ; none
inc ax ; round up
haveNumSwaps:
mov ds:[DCD_numSwaps], ax ; record, just in case
mov_tr dx, ax
mov ax, DCC_REPORT_NUM_SWAPS
call DOSDiskCopyCallCallback ; returns carry set/clear + ax
; set properly if CF=1
done:
.leave
ret
checkAnythingAllocated:
;
; See if we were able to allocate anything. If not, we bitch.
;
tst ds:[DCD_numBuffers]
jnz done
nothingAllocated:
mov ax, ERR_DISKCOPY_INSUFFICIENT_MEM
stc
jmp done
DOSDiskCopyAllocBuffers endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOSDiskCopyCountSwapCallback
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Callback function for DOSDiskCopyProcessClusters to count
the number of buffers used.
CALLED BY: (INTERNAL) DOSDiskCopyAllocBuffers via
DOSDiskCopyProcessClusters
PASS: ds = DiskCopyData
dx = offset of cluster(s)
cx = # bytes to process
si = starting cluster #
RETURN: carry set on error:
ax = DiskCopyError/FormatError
carry clear if ok:
ax = destroyed
DESTROYED: si, di, cx, ax, dx, es all allowed
SIDE EFFECTS: ds:[DCD_numSwaps] may be incremented
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 11/ 8/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOSDiskCopyCountSwapCallback proc near
.enter
;
; If data at the start of a buffer, up DCD_numSwaps, as it's a new
; buffer on which we're working.
;
tst dx
jnz done
inc ds:[DCD_numSwaps]
done:
.leave
ret
DOSDiskCopyCountSwapCallback endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOSDiskCopyProcessDisk
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Process all the used clusters in the disk.
CALLED BY: (INTERNAL) DOSDiskCopyAllocBuffers
PASS: ax = DiskCopyCallback to pass to user callback function.
-1 to not call user callback
cs:di = callback function for DOSDiskCopyProcessClusters
ds = DiskCopyData
RETURN: carry set on error:
ax = DiskCopyError/FormatError
carry clear on success
ax = destroyed
DESTROYED:
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 11/ 8/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOSDiskCopyProcessDisk proc near
.enter
mov ds:[DCD_callbackType], ax
clr ax
mov ds:[DCD_firstCluster], ax ; root dir
mov ds:[DCD_procUsedClust], ax
mov ds:[DCD_procClustCB], di
;
; Start at beginning of FAT, in spite of two reserved clusters. In our
; world, cluster 0 is the boot sector and cluster 1 is the root
; directory.
;
mov ds:[DCD_fatToggle], al
mov ds:[DCD_fatOffset], ax
processLoop:
;
; Process the next batch o' clusters.
;
call DOSDiskCopyProcessClusters
jc done
;
; Advance DCD_firstCluster to be the one after the last one processed
; (returned in DCD_curCluster). If still more clusters to handle,
; loop.
;
mov ax, ds:[DCD_curCluster]
mov ds:[DCD_firstCluster], ax
cmp ax, ds:[DCD_numClusters]
jb processLoop
; carry clear if AE
done:
.leave
ret
DOSDiskCopyProcessDisk endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOSDiskCopyProcessClusters
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Process as many clusters as will fit in the buffers allocated,
calling a callback with each contiguous range of good clusters
and calling the user callback each time we switch to another
buffer.
CALLED BY: (INTERNAL) DOSDiskCopyProcessDisk, DOSDiskCopy
PASS: ds = DiskCopyData
ds:[DCD_firstCluster], ds:[DCD_fatToggle], ds:[DCD_fatOffset],
ds:[DCD_fatSize], ds:[DCD_callbackType], ds:[DCD_procClustCB],
ds:[DCD_procUsedClust]
RETURN: carry set on error (as returned by ds:[DCD_procClustCB]):
ax = DiskCopyError/FormatError
carry clear on success:
ax = destroyed
ds:[DCD_fatOffset], ds:[DCD_fatToggle],
ds:[DCD_procUsedClust] updated
DESTROYED:
SIDE EFFECTS: ds:[DCD_curCluster] set to 1 greater than last cluster
processed
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 11/ 8/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOSDiskCopyProcessClusters proc near
uses bx, cx, dx, si, di, es
.enter
;
; Set dx to the value by which to mask the word fetched from the FAT
; and right-shifted to extract the value for the current cluster.
;
; We cheat a bit and use the value for a bad cluster, which is the
; same as the mask would be, except for b3. Since all we're looking for
; is a value of 0 or FAT_CLUSTER_BAD, neither of which has b3 set, we
; can and the word with a FAT_CLUSTER_BAD appropriate to the FAT size
; after we've checked to see if b3 is set. If b3 is set, we have to
; process the cluster.
;
; This is 0xfff7 for a 16-bit FAT, or 0xff7 for a 12-bit FAT.
;
mov dx, FAT_CLUSTER_BAD
tst ds:[DCD_fatSize]
jz haveFATMask
mov dh, 0x0f
haveFATMask:
;
; Start with first buffer in chain.
;
mov ax, ds:[DCD_firstBuffer]
mov ds:[DCD_curBuffer], ax
;
; No used clusters processed this round, yet.
;
clr di
;
; Lock down the source FAT and point es:si to the data for the start
; cluster.
;
mov bx, ds:[DCD_fatBuffer]
call MemLock
mov es, ax
mov si, ds:[DCD_fatOffset]
;
; Start with the first cluster, as you'd expect.
;
mov ax, ds:[DCD_firstCluster]
mov ds:[DCD_curCluster], ax
bufferLoop:
mov ax, -1
mov ds:[DCD_rangeStart], ax
mov ds:[DCD_prevCluster], ax
mov ds:[DCD_bufferOff], 0
clusterLoop:
;
; Make sure there's room in the buffer for this cluster and the
; existing range.
;
call getRangeSize
add ax, ds:[DCD_bufferOff]
mov cx, ds:[DCD_rootDirSize]
tst ds:[DCD_curCluster]
jz haveClusterSize
mov cx, ds:[DCD_clusterSize]
haveClusterSize:
add ax, cx
cmp ax, ds:[DCD_bufferSize]
ja nextBuffer ; nope -- advance to the next
;
; Check for boot sector or root directory. No matter how big a FAT
; entry is for the disk, cluster 0 will be at offset 0, and cluster
; 1 will be either at offset 1 or 2, both of which are less than 3.
;
cmp si, 3
jb processIt
;
; See if the current cluster is allocated.
;
mov ax, es:[si]
mov cl, ds:[DCD_fatToggle]
shr ax, cl
CheckHack <FAT_CLUSTER_BAD eq 0xfff7>
test ax, 8
jnz processIt ; => can be neither free nor bad
and ax, dx ; mask unnecessary bits
jz doCloseRange ; => free
cmp ax, dx ; bad cluster?
je doCloseRange ; yes => don't process
processIt:
;
; Process a used cluster. A range is always closed by encountering
; a free or bad cluster, or by running out of room in the current
; buffer, so all we have to do here is decide whether we need to start
; a new range, or just extend an existing one.
;
inc di ; another used cluster processed
mov ax, ds:[DCD_prevCluster]
inc ax
jnz extendRange ; => range was active
mov ax, ds:[DCD_curCluster]
mov ds:[DCD_rangeStart], ax ; else record start...
mov ds:[DCD_rangeStartFO], si ; ...and offset of same
mov ds:[DCD_rangeStartFT], cl ; ...and toggle of same
extendRange:
mov ds:[DCD_prevCluster], ax
nextCluster:
;
; Advance to the next cluster on the disk, coping with having been on
; the root directory.
;
mov ax, ds:[DCD_curCluster]
inc ax
cmp ax, 2 ; were we on the root?
je closeRootDir
jb closeBootSect
advanceFATPointer:
mov ds:[DCD_curCluster], ax
cmp ax, ds:[DCD_numClusters]
jae outOfClusters
;
; Advance the pointer into the FAT, coping with 12- vs 16-bit FATs.
;
; For a 12-bit FAT, we need to advance si by 1 if DCD_fatToggle is
; currently 0, as we need to get to the second cluster encoded in the
; 3-byte series. If DCD_fatToggle is non-zero, we need to advance si by
; 2 to get to the next 3-byte series (see dosDiskFormat.asm for further
; information on this phenomenon (DOSFormatProcessBadTrack)).
;
; For a 16-bit FAT, we always need to advance by 2.
;
; This is taken care of by having DCD_fatSize be 0 for a 16-bit FAT, so
; when it's xor'ed with DCD_fatToggle, the result is always 0.
;
inc si
mov al, ds:[DCD_fatSize]
xor ds:[DCD_fatToggle], al
jnz clusterLoop ; => si now correct
inc si ; else advance another
jmp clusterLoop
closeRootDir:
;
; Was the root directory, so close the range.
;
call closeRange
mov ax, 2 ; ax <- first data cluster
jmp advanceFATPointer
closeBootSect:
;
; Was the boot sector, so close the range.
;
call closeRange
mov ax, 1
jmp advanceFATPointer
doCloseRange:
;
; Current cluster is free or bad, so close any open range. If there's
; an error, closeRange will jump to the right place.
;
call closeRange
jmp nextCluster
outOfClusters:
call closeRange
call reportPercentage
jmp done
nextBuffer:
;
; Close the current range before switching buffers.
;
call closeRange
;
; Call the user callback, if desired.
;
call reportPercentage
jc done ; => abort
;
; Advance to the next buffer in the chain.
;
mov bx, ds:[DCD_curBuffer]
mov ax, MGIT_OTHER_INFO
call MemGetInfo ; ax <- handle of next
mov ds:[DCD_curBuffer], ax
tst ax
LONG jnz bufferLoop
done:
;
; Record final FAT offset for next call.
;
mov ds:[DCD_fatOffset], si
;
; Unlock the FAT and get out of here with ax and carry flag intact
;
mov bx, ds:[DCD_fatBuffer]
call MemUnlock
.leave
ret
;--------------------
; Figure how big the current range is, in bytes.
;
; Pass: ds:[DCD_prevCluster] = end of range
; ds:[DCD_rangeStart] = start of range
; Return: ax = size of range, in bytes (0 if no range
; active)
; Destroyed: cx
;
getRangeSize:
push dx
mov ax, ds:[DCD_prevCluster]
inc ax
jz haveRangeSize ; => no range, so 0 size
mov cx, ds:[DCD_rangeStart]
cmp cx, 1
jb useSectorSize ; => boot sector
je useRootDirSize ; => root dir
sub ax, cx ; ax <- # clusters
mul ds:[DCD_clusterSize]
haveRangeSize:
pop dx
retn
useRootDirSize:
mov ax, ds:[DCD_rootDirSize]
pop dx
retn
useSectorSize:
mov ax, ds:[DCD_bpb].BPB_sectorSize
pop dx
retn
;--------------------
; Close any open range. If callback returns an error, don't return to
; the caller, but vault to done directly, after clearing the return
; address off the stack.
;
; Pass: ds:[DCD_prevCluster] = end of range
; ds:[DCD_rangeStart] = start of range
; Return: nothing
; Destroyed: ax, cx, dx
closeRange:
;
; Figure how big the range is, in bytes (callback can convert it to
; sectors using that)
;
call getRangeSize
tst ax
jz closeRangeDone
push es, si, di, dx
;
; Load registers for the callback.
; cx = # bytes in cluster range
; si = starting cluster # (0 => root dir)
; dx = offset in buffer of cluster(s)
;
mov_tr cx, ax ; cx <- # bytes
mov si, -1 ; signal no range in progress...
mov ds:[DCD_prevCluster], si
xchg si, ds:[DCD_rangeStart] ; ...while fetching start
mov dx, ds:[DCD_bufferOff]
add ds:[DCD_bufferOff], cx
;
; Fetch the callback we're to call. As a hack, if the callback is
; DOSDiskCopyCountSwapCallback, don't lock the buffer down, as that
; would cause a lot of swapping, if doing a greedy single-drive
; copy, when we know the callback isn't going to do anything with
; the locked buffer anyway.
;
mov di, ds:[DCD_procClustCB]
clr bx
cmp di, offset DOSDiskCopyCountSwapCallback
je callCallback
;
; Lock down the buffer.
;
mov bx, ds:[DCD_curBuffer]
call MemLock
mov es, ax
callCallback:
call di ; may destroy si, di, cx, ax, dx, es
; must preserve bx, ds, bp
pop es, si, di, dx
mov cx, bx ; see if we need to unlock the buffer
jcxz checkError ; w/o biffing the carry
call MemUnlock
checkError:
jnc closeRangeDone
;
; Error -- get out of this whole function sneakily
;
inc sp ; nuke old return address...
inc sp
mov bx, offset done ; ...replacing it with that of "done"
push bx
closeRangeDone:
retn
;--------------------
; Pass: di = # used clusters in current buffer
; ds = DiskCopyData
; Return: carry set if should abort:
; ax = ERR_OPERATION_CANCELLED
; carry clear if should continue
; ax = destroyed
; di = 0
; ds:[DCD_procUsedClust] = updated
; Destroyed: nothing
;
reportPercentage:
push dx
mov ax, ds:[DCD_procUsedClust]
add ax, di ; ax <- # user clusters
; processed
mov ds:[DCD_procUsedClust], ax
clr di
mov dx, 100 ; * 100, so we get percentage
mul dx
div ds:[DCD_numUsedClust] ; ax <- percentage done
mov_tr dx, ax ; pass it in dx
mov ax, ds:[DCD_callbackType]
cmp ax, -1
je reportPercentageDone
call DOSDiskCopyCallCallback
reportPercentageDone:
pop dx
retn
DOSDiskCopyProcessClusters endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOSDiskCopyCleanUp
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Clean up everything that needs cleaning up.
CALLED BY: (INTERNAL) DOSDiskCopy
PASS: ds = DiskCopyData
RETURN: nothing
DESTROYED: ds (flags preserved)
SIDE EFFECTS: everything that needs freeing or unlocking is freed or
unlocked
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 11/ 8/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOSDiskCopyCleanUp proc near
uses ax, bx, si, es
.enter
pushf
;
; Make sure the FSIR is locked, so we can unlock the drives.
;
test ds:[DCD_status], mask DCS_FSIR_LOCKED
jnz derefFSIR ; => already locked
call DOSDiskCopyLockInfoShared
derefFSIR:
call FSDDerefInfo
mov es, ax
;
; Unlock the source disk.
;
mov si, ds:[DCD_args].FSCA_disk
call DOSDiskUnlock
;
; Unlock the drives, if necessary.
;
test ds:[DCD_status], mask DCS_DRIVES_LOCKED
jz unlockFSIR
mov si, ds:[DCD_args].FSCA_dest
call FSDUnlockDriveExcl
cmp si, ds:[DCD_args].FSCA_source
je unlockFSIR
mov si, ds:[DCD_args].FSCA_source
call FSDUnlockDriveExcl
unlockFSIR:
;
; Done with the FSIR, so unlock it.
;
call FSDUnlockInfoShared
;
; Now free all the buffers we managed to allocate.
;
mov ax, ds:[DCD_firstBuffer]
freeBufferLoop:
mov_tr bx, ax
tst bx
jz freeOtherBuffers
mov ax, MGIT_OTHER_INFO
call MemGetInfo ; ax <- next buffer
call MemFree ; free this one
jmp freeBufferLoop
freeOtherBuffers:
;
; Free the FAT buffer
;
mov bx, ds:[DCD_fatBuffer]
call freeMe
;
; Free the workspace itself.
;
mov bx, ds:[DCD_handle]
call MemFree
;
; Recover error flag and everything else.
;
popf
.leave
ret
;--------------------
freeMe:
tst bx
jz freeMeDone
call MemFree
freeMeDone:
retn
DOSDiskCopyCleanUp endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOSDiskCopyCallCallback
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Call the user's callback routine.
CALLED BY: (INTERNAL)
PASS: ds = DiskCopyData
ax = DiskCopyCallback
dx = parameter for it.
RETURN: carry set if operation cancelled by the callback:
ax = ERR_OPERATION_CANCELLED
carry clear if ok:
ax = destroyed
DESTROYED: dx
SIDE EFFECTS: none
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 11/ 8/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOSDiskCopyCallCallback proc near
.enter
FXIP< mov ss:[TPD_dataAX], ax >
FXIP< mov ss:[TPD_dataBX], bx >
FXIP< movdw bxax, ds:[DCD_args].FSCA_callback >
FXIP< call ProcCallFixedOrMovable >
NOFXIP< call ds:[DCD_args].FSCA_callback >
tst ax
jz done
mov ax, ERR_OPERATION_CANCELLED
stc
done:
.leave
ret
DOSDiskCopyCallCallback endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOSDiskCopyAskForDisk
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Use the callback routine to ask the user for the disk.
CALLED BY: (INTERNAL) DOSDiskCopy
PASS: ax = DiskCopyCallback
ds:[si] = location of DSE offset for drive
RETURN: carry set if user cancelled:
ax = ERR_OPERATION_CANCELLED
carry clear if ok:
ax = destroyed
DESTROYED: es, si, dx
SIDE EFFECTS: none
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 11/ 8/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOSDiskCopyAskForDisk proc near
test ds:[DCD_status], mask DCS_SINGLE_DRIVE
jz done
;
; Extract the number for the appropriate drive.
;
call DOSDiskCopyLockInfoShared
mov si, ds:[si]
mov dl, es:[si].DSE_number
call DOSDiskCopyUnlockInfoShared
;
; Call the callback routine as usual.
;
call DOSDiskCopyCallCallback
done:
ret
DOSDiskCopyAskForDisk endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOSDiskCopyReadClusters
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Read clusters for DOSDiskCopyProcessClusters
CALLED BY: (INTERNAL) DOSDiskCopyProcessClusters
PASS: ds = DiskCopyData
es:dx = place to which to read the clusters
cx = # bytes to read
si = first cluster to read
RETURN: carry set if couldn't read:
ax = ERR_CANT_READ_FROM_SOURCE
carry clear if ok:
ax = destroyed
DESTROYED: si, di, cx, ax, dx, es allowed
bx, ds, bp must be preserved
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 11/ 8/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOSDiskCopyReadClusters proc near
uses bx
.enter
push ds
;
; Convert the bytes and starting number to sectors.
;
push ds:[DCD_realSource]
call DOSDiskCopyConvertToSectors
;
; Read dem sectors.
;
pop si ; es:si <- DSE
call DOSReadSectors
jnc done
mov ax, ERR_CANT_READ_FROM_SOURCE
done:
pop ds
call DOSDiskCopyUnlockInfoShared
.leave
ret
DOSDiskCopyReadClusters endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOSDiskCopyConvertToSectors
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Convert DOSDiskCopyProcessClusters callback arguments to
sector arguments suitable for passing to DOSReadSectors
or DOSWriteSectors
CALLED BY: (INTERNAL) DOSDiskCopyReadClusters,
DOSDiskCopyWriteClusters
PASS: cx = # bytes for transfer
si = starting cluster number (0 => boot sector,
1 => root dir)
es:dx = transfer location
ds = DiskCopyData
RETURN: bx:dx = starting sector number
cx = number of sectors
es = FSIR locked shared
ds:di = transfer location
DESTROYED:
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 11/ 8/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOSDiskCopyConvertToSectors proc near
.enter
mov di, dx ; di <- transfer loc offset
;
; Compute the number of sectors.
;
mov_tr cx, ax
clr dx
div ds:[DCD_bpb].BPB_sectorSize
mov_tr cx, ax
EC < tst dx ; s/b no remainder >
EC < ERROR_NZ GASP_CHOKE_WHEEZE >
;
; Compute starting sector.
;
cmp si, 1
jz isRootDir
jb isBootSector
dec si ; 2 reserved clusters don't
dec si ; count
mov al, ds:[DCD_bpb].BPB_clusterSize
clr ah
mul si ; dxax <- # sectors from start o'
; files area
add ax, ds:[DCD_startFiles]
adc dx, 0 ; just being careful, even though
; this will never actually carry
xchg dx, ax ; dx <- low word of sector #, ax <- high
mov_tr bx, ax ; bx <- high word of sector #
lockFSIR:
;
; Lock the FSIR down for the caller.
;
push es
call DOSDiskCopyLockInfoShared
pop ds
.leave
ret
isRootDir:
;
; Figure starting sector of root directory (beyond boot sector and
; both FATs).
;
mov ax, ds:[DCD_bpb].BPB_sectorsPerFAT
mul ds:[DCD_bpb].BPB_numFATs
add ax, ds:[DCD_bpb].BPB_numReservedSectors
mov_tr dx, ax
clr bx
jmp lockFSIR
isBootSector:
;
; Boot sector is sector 0, of course.
;
clr dx, bx
jmp lockFSIR
DOSDiskCopyConvertToSectors endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOSDiskCopyWriteClusters
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Write a mess o' clusters to the destination disk.
CALLED BY: (INTERNAL) DOSDiskCopyProcessClusters
PASS: ds = DiskCopyData
es:dx = place from which to write the clusters
cx = # bytes to write
si = first cluster to write
ds:[DCD_rangeStartFO], ds:[DCD_rangeStartFT] set
RETURN: carry set if couldn't read:
ax = ERR_CANT_READ_FROM_SOURCE
carry clear if ok:
ax = destroyed
DESTROYED: si, di, cx, ax, dx, es allowed
bx, ds, bp must be preserved
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 11/ 8/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOSDiskCopyWriteClusters proc near
uses bx, ds
.enter
push es, dx, cx, si ; save for when we actually write stuff
cmp si, 1 ; boot sector or root dir?
ja markDestFAT ; no
je doWrite ; => root directory
;
; Before writing the boot sector, we want to format the destination
; disk.
;
call DOSDiskCopyFormatDest
jc doWrite
;
; Change the ID in the boot sector we got from the source disk to match
; that just given to the destination disk.
;
pop es, dx, cx, si
mov bx, dx
movdw axdi, ds:[DCD_destDiskID]
cmp es:[bx].BS_extendedBootSig, EXTENDED_BOOT_SIGNATURE
je storeDiskIDInBS_volumeID
.warn -field ; I know. I know...
movdw es:[bx].BS_oemNameAndVersion.DIS_id, axdi
mov es:[bx].BS_oemNameAndVersion.DIS_present,
DISK_ID_PRESENT
.warn @field
jmp doWriteRegistersPopped
storeDiskIDInBS_volumeID:
movdw es:[bx].BS_volumeID, axdi
jmp doWriteRegistersPopped
markDestFAT:
;
; Transfer the FAT entries for this range from the source disk to the
; destination.
;
call DOSDiskCopyTransferFATEntries
doWrite:
pop es, dx, cx, si
jc done
doWriteRegistersPopped:
;
; Write all the sectors to the destination.
;
push ds
push ds:[DCD_realDest]
call DOSDiskCopyConvertToSectors
pop si ; es:si <- DSE
call DOSWriteSectors
jnc unlockFSIR
mov ax, ERR_CANT_WRITE_TO_DEST
unlockFSIR:
pop ds
call DOSDiskCopyUnlockInfoShared
done:
.leave
ret
DOSDiskCopyWriteClusters endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOSDiskCopyFormatDest
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Format the destination disk after confirming it's ok.
CALLED BY: (INTERNAL) DOSDiskCopyWriteClusters
PASS: ds = DiskCopyData
RETURN: carry set on error:
ax = DiskCopyError/FormatError
carry clear if ok:
ax = destroyed
DESTROYED: es, si, dx, cx, bx allowed
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 11/ 8/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOSDiskCopyFormatDest proc near
.enter
;
; If you're familiar with DiskRegisterCommon, this will look familiar
; to you. Unfortunately, we can't use DiskRegister, since it will try
; and lock the drive exclusive, and we already have it locked
; exclusive. So...
;
; Fetch the ID from the disk currently in the drive.
;
call DOSDiskCopyLockInfoShared
mov si, ds:[DCD_realDest]
clr bx ; assume not formatted
call DOSDiskID
jc doFormat
;
; Disk is formatted. Locate a disk for the thing, if possible.
;
mov bx, offset FIH_diskList - offset DD_next
diskLoop:
mov bx, es:[bx].DD_next
tst bx
jz notFound
cmp es:[bx].DD_id.low, dx ; low ID word matches?
jne diskLoop ; nope
cmp es:[bx].DD_id.high, cx ; high ID word matches?
jne diskLoop ; nope
cmp es:[bx].DD_drive, si ; same drive?
jne diskLoop ; nope
jmp verifyDestruction
notFound:
;
; Couldn't find a disk handle for the thing, but we need to create one
; as we need to ask the user if s/he really wants to biff the thing.
;
mov bh, FNA_SILENT ; be silent if unnamed, as (1) disk
; will get a new name in a moment, and
; (2) caller will likely prompt with
; appropriate name showing
push bp, ds
mov bp, es:[si].DSE_fsd
segmov ds, es ; ds <- FSIR
call DiskAllocAndInit ; THIS RELEASES EXCLUSIVE
; ACCESS TO THE DRIVE
;
; Regain exclusive access to the destination drive, regardless.
; Even if src and dest are the same drive, there's but one lock
; on the thing, and we need it.
;
segmov es, ds ; es <- FSIR
pop bp, ds ; ds <- DCD
pushf
call FSDLockDriveExcl
popf
jnc verifyDestruction
mov ax, ERR_COULD_NOT_REGISTER_FORMATTED_DESTINATION_DISK
unlockFSIR:
call DOSDiskCopyUnlockInfoShared
stc
jmp done
verifyDestruction:
;
; Ask the callback routine if it really wants us to nuke this thing
;
mov dl, es:[si].DSE_number
call DOSDiskCopyUnlockInfoShared
;
; But first, check with the system to see if the user should
; even be given the opportunity.
;
call DiskCheckInUse
mov ax, ERR_DISK_IS_IN_USE
jc done
mov ax, DCC_VERIFY_DEST_DESTRUCTION
call DOSDiskCopyCallCallback
jc done ; no
;
; Ok. Since we might have had to give up control of the drive, make
; sure the destination disk is in the drive.
;
call DOSDiskCopyLockInfoShared
mov si, bx
clr al ; lock abort allowed
call DOSDiskLock
mov ax, ERR_OPERATION_CANCELLED
jc unlockFSIR
mov bx, si
mov si, es:[si].DD_drive
;--------------------
doFormat:
;
; Either destination is unformatted or user has granted our request
; to blow the monster out of the water. Do so now.
;
push bx ; save DiskDesc nptr(if disk formatted)
call DOSDiskCopyPerformFormat
pop si ; si = DiskDesc nptr
pushf
tst si
jz noNeedToUnlock ; if dest disk was originally
; unformatted, we didn't call
; DOSDiskLock earlier.
call DOSDiskCopyLockInfoShared ; es:si = DIskDesc
call DOSDiskUnlock
call DOSDiskCopyUnlockInfoShared
noNeedToUnlock:
popf
jc done
;
; Read the destination disk's FAT to the latter half of the FAT
; buffer
;
call DOSDiskCopyLockInfoShared
mov di, ds:[DCD_destFATOff]
mov dx, ds:[DCD_bpb].BPB_numReservedSectors
mov cx, ds:[DCD_bpb].BPB_sectorsPerFAT
mov si, ds:[DCD_realDest]
push ds
mov bx, ds:[DCD_fatBuffer]
call MemDerefDS ; ds:di <- transfer point
clr bx ; bx:dx <- sector #
call DOSReadSectors
pop ds
mov ax, ERR_CANT_WRITE_TO_DEST ; XXX
jc done
;
; Read FAT successfully, so unlock the FSIR (if read unsuccessfully,
; DOSDiskCopyCleanUp will unlock the thing for us)
;
call DOSDiskCopyUnlockInfoShared
done:
.leave
ret
DOSDiskCopyFormatDest endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOSDiskCopyPerformFormat
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Actually format the destination disk.
CALLED BY: (INTERNAL) DOSDiskCopyFormatDest
PASS: es:bx = DiskDesc (bx = 0 if none)
es:si = DriveStatusEntry
ds = DiskCopyData
RETURN: carry set on error:
ax = FormatError
carry clear if ok:
ax = destroyed
FSInfoResource unlocked
DESTROYED: bx, si, ax, di, es
SIDE EFFECTS: none
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 11/ 8/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOSDiskCopyPerformFormat proc near
args local FSFormatArgs
volumeLabel local VolumeName
.enter
;
; Set the disk and drive
;
mov ss:[args].FSFA_disk, bx
mov ss:[args].FSFA_dse, si
mov al, es:[si].DSE_number
mov ss:[args].FSFA_drive, al
;
; Tell it to call us back with percentages, and allow quick format
;
mov ss:[args].FSFA_flags, mask DFF_CALLBACK_PCT_DONE
;
; Specify whom it should call.
;
mov ss:[args].FSFA_callback.segment, SEGMENT_CS
mov ss:[args].FSFA_callback.offset,
offset DOSDiskCopyFormatCallback
;
; Insist that it pass our DiskCopyData back to us in DS.
;
mov ss:[args].FSFA_ds, ds
;
; Fetch the target media type from the source disk.
;
mov bx, ds:[DCD_args].FSCA_disk
mov al, es:[bx].DD_media
mov ss:[args].FSFA_media, al
;
; Make a copy of the volume label in the source disk, since the FSIR
; could well move around during the format.
;
lea si, es:[bx].DD_volumeLabel
lea di, ss:[volumeLabel]
mov ss:[args].FSFA_volumeName.offset, di
mov ss:[args].FSFA_volumeName.segment, ss
segmov ds, es
segmov es, ss
mov cx, size DD_volumeLabel
rep movsb
clr al ; null-terminate the space-padded
stosb ; volume label
;
; Release the FSIR.
;
mov ds, ss:[args].FSFA_ds
call DOSDiskCopyUnlockInfoShared
;
; Call ourselves to format the disk.
;
lea bx, ss:[args] ; ss:bx <- FSFormatArgs
push bp
call DOSDiskFormat
pop bp
jc done
;
; Fetch the 32-bit ID that gave to the disk and save it for mangling
; the boot sector we got from the source disk.
;
call DOSDiskCopyLockInfoShared
mov si, ds:[DCD_realDest]
call DOSDiskID
call DOSDiskCopyUnlockInfoShared
movdw ds:[DCD_destDiskID], cxdx
jnc done
mov ax, ERR_COULD_NOT_REGISTER_FORMATTED_DESTINATION_DISK
done:
.leave
ret
DOSDiskCopyPerformFormat endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOSDiskCopyFormatCallback
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Call our own callback telling it the percentage of the
disk that's formatted.
CALLED BY: (INTERNAL) DOSDiskCopyFormatDest via DOSDiskFormat
PASS: ds = DiskCopyData
ax = percentage done
RETURN: carry set to cancel
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 11/ 8/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOSDiskCopyFormatCallback proc far
uses dx
.enter
mov_tr dx, ax ; dx <- percentage
mov ax, DCC_REPORT_FORMAT_PCT
call DOSDiskCopyCallCallback
.leave
ret
DOSDiskCopyFormatCallback endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOSDiskCopyTransferFATEntries
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Transfer the values for the current cluster range from the
source FAT to the destination, ensuring that none of the
destination clusters is marked bad.
CALLED BY: (INTERNAL) DOSDiskCopyWriteClusters
PASS: ds = DiskCopyData
si = first cluster to write
cx = # bytes to write
RETURN: carry set on error:
ax = DiskCopyError
carry clear if ok
DESTROYED: es, si, dx, cx, bx, di allowed
SIDE EFFECTS: entries in the destination FAT are abused.
PSEUDO CODE/STRATEGY:
Calculate # of clusters in range
Point to first entry in source FAT
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 11/ 8/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOSDiskCopyTransferFATEntries proc near
uses bp
.enter
mov_tr ax, cx
clr dx
div ds:[DCD_clusterSize]
mov_tr bp, ax ; bp <- # clusters
;
; Set up es:si to point to the proper place in the source FAT, and
; es:di to point to the proper place in the dest FAT.
;
mov bx, ds:[DCD_fatBuffer]
call MemDerefES
mov si, ds:[DCD_rangeStartFO]
mov di, ds:[DCD_destFATOff]
add di, si
mov cl, ds:[DCD_rangeStartFT] ; cl <- initial toggle
; value
mov dx, 0xffff
tst ds:[DCD_fatSize]
jz setClusterBad
mov dh, 0x0f
setClusterBad:
mov bx, FAT_CLUSTER_BAD
and bx, dx
entryLoop:
;
; es:si = source FAT entry
; es:di = dest FAT entry
; bx = FAT_CLUSTER_BAD, to proper # bits
; dx = mask for obtaining cluster entry
; cl = fatToggle
; bp = # clusters to process
;
; Fetch dest FAT's value so we can see if it's bad.
;
mov ax, es:[di]
shr ax, cl
and ax, dx
cmp ax, bx
je error
EC < tst ax >
EC < ERROR_NZ GASP_CHOKE_WHEEZE >
;
; Dest entry not bad, so fetch source and merge it into the dest.
;
mov ax, dx
rol ax, cl ; ax <- mask for fetching source
; cluster entry properly shifted
and ax, es:[si] ; ax <- cluster entry, properly
; shifted
or es:[di], ax ; merge into dest
dec bp
jz done ; (carry cleared by OR)
inc si ; always advance at least 1
inc di
xor cl, ds:[DCD_fatSize] ; change toggle
jnz entryLoop ; => now odd cluster, so advance no more
inc si ; else advance to new 3-byte set
inc di
jmp entryLoop
done:
.leave
ret
error:
;
; Found a bad cluster on the dest where a good cluster needs to be.
; Don't even try to write to it, but declare an error.
;
mov ax, ERR_CANT_WRITE_TO_DEST
stc
jmp done
DOSDiskCopyTransferFATEntries endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOSDiskCopyWriteFATs
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Write out the destination FAT we've been building.
CALLED BY: (INTERNAL) DOSDiskCopy
PASS: ds = DiskCopyData
RETURN: carry set on error:
ax = ERR_CANT_WRITE_TO_DEST
carry clear if ok:
ax = destroyed
DESTROYED: bx, cx, dx, si, di, es
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 11/ 8/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOSDiskCopyWriteFATs proc near
.enter
call DOSDiskCopyLockInfoShared
;
; Set up most registers for DOSWriteSectors.
; dx = sector number
; ds:di = data to write
; cx = # sectors to write
; es:si = DriveStatusEntry
;
; In addition:
; bl = # FATs left to write.
;
mov dx, ds:[DCD_bpb].BPB_numReservedSectors
mov di, ds:[DCD_destFATOff]
mov cx, ds:[DCD_bpb].BPB_sectorsPerFAT
mov si, ds:[DCD_realDest]
push ds
push {word}ds:[DCD_bpb].BPB_numFATs
mov bx, ds:[DCD_fatBuffer]
call MemLock
mov ds, ax
pop bx
fatLoop:
push bx
;
; Write this copy out.
;
clr bx
call DOSWriteSectors
pop bx
jc error
;
; Advance to next FAT on the disk.
;
add dx, cx
dec bl
jnz fatLoop
done:
;
; Recover our beloved DiskCopyData and unlock the FAT buffer.
;
pop ds
mov bx, ds:[DCD_fatBuffer]
call MemUnlock
.leave
ret
error:
mov ax, ERR_CANT_WRITE_TO_DEST
stc
jmp done
DOSDiskCopyWriteFATs endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DOSDiskCopyCopyDisk
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Main loop for copying a disk.
CALLED BY: (INTERNAL) DOSDiskCopy
PASS: ds = DiskCopyData
RETURN: carry set on error:
ax = DiskCopyError/FormatError
carry clear if ok:
ax = destroyed
DESTROYED: bx, cx, dx, si, di, es
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 11/ 8/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DOSDiskCopyCopyDisk proc far
.enter
clr ax
mov ds:[DCD_firstCluster], ax ; root dir
mov ds:[DCD_procUsedClust], ax
;
; Start at beginning of FAT, in spite of two reserved clusters. In our
; world, cluster 0 is the boot sector and cluster 1 is the root
; directory.
;
mov ds:[DCD_fatToggle], al
mov ds:[DCD_fatOffset], ax
processLoop:
if _REDMS4
call getDiskGeo
endif
;
; Read a mess o' things
;
mov ds:[DCD_procClustCB], offset DOSDiskCopyReadClusters
mov ds:[DCD_callbackType], DCC_REPORT_READ_PCT
push ds:[DCD_fatOffset],
{word}ds:[DCD_fatToggle],
ds:[DCD_procUsedClust]
call DOSDiskCopyProcessClusters
CheckHack <offset DCD_fatToggle+1 eq offset DCD_fatSize>
pop ds:[DCD_fatOffset],
{word}ds:[DCD_fatToggle],
ds:[DCD_procUsedClust]
jc jmpDone
jmp getDestDisk
jmpDone:
jmp done
;
; Don't change DCD_firstCluster, as we need it for writing. If single-
; drive copy, use the callback to get the destination disk.
;
getDestDisk:
mov ax, DCC_GET_DEST_DISK
mov si, offset DCD_args.FSCA_dest
call DOSDiskCopyAskForDisk
jc jmpDone
test ds:[DCD_status], mask DCS_SINGLE_DRIVE
jz haveDest
;
; Make sure the user did as (s)he's told.
; If we get an error fetching the ID, then just assume the
; disk isn't formatted yet.
;
mov si, ds:[DCD_realDest] ; dest disk handle
call getID
jc haveDest
tstdw ds:[DCD_destDiskID]
jnz checkDestID
;
; The destination disk doesn't yet have an ID, so just make
; sure the ID isn't the same as the source ID
;
mov si, ds:[DCD_args].FSCA_disk
call cmpID
je getDestDisk
jmp haveDest
checkDestID:
cmpdw cxdx, ds:[DCD_destDiskID]
jne getDestDisk
jmp haveDest
haveDest:
if _REDMS4
call getDiskGeo
endif
;
; Write what we read.
;
mov ds:[DCD_procClustCB], offset DOSDiskCopyWriteClusters
mov ds:[DCD_callbackType], DCC_REPORT_WRITE_PCT
call DOSDiskCopyProcessClusters
jc done
;
; Advance DCD_firstCluster to be the one after the last one processed
; (returned in DCD_curCluster). If still more clusters to handle,
; loop.
;
mov ax, ds:[DCD_curCluster]
mov ds:[DCD_firstCluster], ax
cmp ax, ds:[DCD_numClusters]
jae writeDestFATs
getSourceDisk:
mov ax, DCC_GET_SOURCE_DISK
mov si, offset DCD_args.FSCA_source
call DOSDiskCopyAskForDisk
jc done
;
; Make sure the user did as (s)he's told
;
test ds:[DCD_status], mask DCS_SINGLE_DRIVE
LONG jz processLoop
mov si, ds:[DCD_args].FSCA_source
call getID
jc getSourceDisk
mov si, ds:[DCD_args].FSCA_disk
call cmpID
jne getSourceDisk
jmp processLoop
done:
.leave
ret
writeDestFATs:
;
; Write the destination FAT to the destination disk as many times as
; necessary.
;
call DOSDiskCopyWriteFATs
jmp done
if _REDMS4
getDiskGeo label near
;
; Force a read of the source disk. In Redwood, Datalight DOS seems
; to screw up on the first read-sector on the second pass through here,
; because of a disk changed error. We'll attempt to head that off
; by doing a disk read here. -cbh 3/14/94
;
push bx, dx, ax, ds, es, bp, cx
call DOSPreventCriticalErr
mov bx, ds:[DCD_args].FSCA_disk
call DiskGetDrive
mov dl, al
inc dl ; 1-based
mov ah, MSDOS_GET_DISK_GEOMETRY
call DOSUtilInt21
call DOSAllowCriticalErr
pop bx, dx, ax, ds, es, bp, cx
retn
endif
;;--------------------
getID:
call DOSDiskCopyLockInfoShared
call DOSDiskID ; cx:dx - ID
call DOSDiskCopyUnlockInfoShared
retn
;;--------------------
cmpID:
call DOSDiskCopyLockInfoShared
cmpdw cxdx, es:[si].DD_id
call DOSDiskCopyUnlockInfoShared
retn
DOSDiskCopyCopyDisk endp
DiskCopyCode ends
|
#pragma once
#include "StatusEffectCalculator.hpp"
#include "Creature.hpp"
// Class used to determine whether a creature is blinded (typically by
// the smoke from a flaming attack), and if so, for how long.
class BlindedCalculator : public StatusEffectCalculator
{
public:
int calculate_pct_chance_effect(CreaturePtr creature) const override;
int calculate_duration_in_minutes(CreaturePtr creature) const override;
protected:
static const int BASE_BLINDED_DURATION_MEAN;
static const int BASE_BLINDED_PCT_CHANCE;
static const int BASE_BLINDED_CHANCE_HEALTH_MODIFIER;
};
|
;
; 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.
;
EXPORT |vp8_sub_pixel_variance16x16_neon|
ARM
REQUIRE8
PRESERVE8
AREA ||.text||, CODE, READONLY, ALIGN=2
; r0 unsigned char *src_ptr,
; r1 int src_pixels_per_line,
; r2 int xoffset,
; r3 int yoffset,
; stack(r4) unsigned char *dst_ptr,
; stack(r5) int dst_pixels_per_line,
; stack(r6) unsigned int *sse
;note: most of the code is copied from bilinear_predict16x16_neon and vp8_variance16x16_neon.
|vp8_sub_pixel_variance16x16_neon| PROC
push {r4-r6, lr}
ldr r12, _BilinearTaps_coeff_
ldr r4, [sp, #16] ;load *dst_ptr from stack
ldr r5, [sp, #20] ;load dst_pixels_per_line from stack
ldr r6, [sp, #24] ;load *sse from stack
cmp r2, #0 ;skip first_pass filter if xoffset=0
beq secondpass_bfilter16x16_only
add r2, r12, r2, lsl #3 ;calculate filter location
cmp r3, #0 ;skip second_pass filter if yoffset=0
vld1.s32 {d31}, [r2] ;load first_pass filter
beq firstpass_bfilter16x16_only
sub sp, sp, #272 ;reserve space on stack for temporary storage
vld1.u8 {d2, d3, d4}, [r0], r1 ;load src data
mov lr, sp
vld1.u8 {d5, d6, d7}, [r0], r1
mov r2, #3 ;loop counter
vld1.u8 {d8, d9, d10}, [r0], r1
vdup.8 d0, d31[0] ;first_pass filter (d0 d1)
vld1.u8 {d11, d12, d13}, [r0], r1
vdup.8 d1, d31[4]
;First Pass: output_height lines x output_width columns (17x16)
vp8e_filt_blk2d_fp16x16_loop_neon
pld [r0]
pld [r0, r1]
pld [r0, r1, lsl #1]
vmull.u8 q7, d2, d0 ;(src_ptr[0] * Filter[0])
vmull.u8 q8, d3, d0
vmull.u8 q9, d5, d0
vmull.u8 q10, d6, d0
vmull.u8 q11, d8, d0
vmull.u8 q12, d9, d0
vmull.u8 q13, d11, d0
vmull.u8 q14, d12, d0
vext.8 d2, d2, d3, #1 ;construct src_ptr[1]
vext.8 d5, d5, d6, #1
vext.8 d8, d8, d9, #1
vext.8 d11, d11, d12, #1
vmlal.u8 q7, d2, d1 ;(src_ptr[0] * Filter[1])
vmlal.u8 q9, d5, d1
vmlal.u8 q11, d8, d1
vmlal.u8 q13, d11, d1
vext.8 d3, d3, d4, #1
vext.8 d6, d6, d7, #1
vext.8 d9, d9, d10, #1
vext.8 d12, d12, d13, #1
vmlal.u8 q8, d3, d1 ;(src_ptr[0] * Filter[1])
vmlal.u8 q10, d6, d1
vmlal.u8 q12, d9, d1
vmlal.u8 q14, d12, d1
subs r2, r2, #1
vqrshrn.u16 d14, q7, #7 ;shift/round/saturate to u8
vqrshrn.u16 d15, q8, #7
vqrshrn.u16 d16, q9, #7
vqrshrn.u16 d17, q10, #7
vqrshrn.u16 d18, q11, #7
vqrshrn.u16 d19, q12, #7
vqrshrn.u16 d20, q13, #7
vld1.u8 {d2, d3, d4}, [r0], r1 ;load src data
vqrshrn.u16 d21, q14, #7
vld1.u8 {d5, d6, d7}, [r0], r1
vst1.u8 {d14, d15, d16, d17}, [lr]! ;store result
vld1.u8 {d8, d9, d10}, [r0], r1
vst1.u8 {d18, d19, d20, d21}, [lr]!
vld1.u8 {d11, d12, d13}, [r0], r1
bne vp8e_filt_blk2d_fp16x16_loop_neon
;First-pass filtering for rest 5 lines
vld1.u8 {d14, d15, d16}, [r0], r1
vmull.u8 q9, d2, d0 ;(src_ptr[0] * Filter[0])
vmull.u8 q10, d3, d0
vmull.u8 q11, d5, d0
vmull.u8 q12, d6, d0
vmull.u8 q13, d8, d0
vmull.u8 q14, d9, d0
vext.8 d2, d2, d3, #1 ;construct src_ptr[1]
vext.8 d5, d5, d6, #1
vext.8 d8, d8, d9, #1
vmlal.u8 q9, d2, d1 ;(src_ptr[0] * Filter[1])
vmlal.u8 q11, d5, d1
vmlal.u8 q13, d8, d1
vext.8 d3, d3, d4, #1
vext.8 d6, d6, d7, #1
vext.8 d9, d9, d10, #1
vmlal.u8 q10, d3, d1 ;(src_ptr[0] * Filter[1])
vmlal.u8 q12, d6, d1
vmlal.u8 q14, d9, d1
vmull.u8 q1, d11, d0
vmull.u8 q2, d12, d0
vmull.u8 q3, d14, d0
vmull.u8 q4, d15, d0
vext.8 d11, d11, d12, #1 ;construct src_ptr[1]
vext.8 d14, d14, d15, #1
vmlal.u8 q1, d11, d1 ;(src_ptr[0] * Filter[1])
vmlal.u8 q3, d14, d1
vext.8 d12, d12, d13, #1
vext.8 d15, d15, d16, #1
vmlal.u8 q2, d12, d1 ;(src_ptr[0] * Filter[1])
vmlal.u8 q4, d15, d1
vqrshrn.u16 d10, q9, #7 ;shift/round/saturate to u8
vqrshrn.u16 d11, q10, #7
vqrshrn.u16 d12, q11, #7
vqrshrn.u16 d13, q12, #7
vqrshrn.u16 d14, q13, #7
vqrshrn.u16 d15, q14, #7
vqrshrn.u16 d16, q1, #7
vqrshrn.u16 d17, q2, #7
vqrshrn.u16 d18, q3, #7
vqrshrn.u16 d19, q4, #7
vst1.u8 {d10, d11, d12, d13}, [lr]! ;store result
vst1.u8 {d14, d15, d16, d17}, [lr]!
vst1.u8 {d18, d19}, [lr]!
;Second pass: 16x16
;secondpass_filter
add r3, r12, r3, lsl #3
sub lr, lr, #272
vld1.u32 {d31}, [r3] ;load second_pass filter
sub sp, sp, #256
mov r3, sp
vld1.u8 {d22, d23}, [lr]! ;load src data
vdup.8 d0, d31[0] ;second_pass filter parameters (d0 d1)
vdup.8 d1, d31[4]
mov r12, #4 ;loop counter
vp8e_filt_blk2d_sp16x16_loop_neon
vld1.u8 {d24, d25}, [lr]!
vmull.u8 q1, d22, d0 ;(src_ptr[0] * Filter[0])
vld1.u8 {d26, d27}, [lr]!
vmull.u8 q2, d23, d0
vld1.u8 {d28, d29}, [lr]!
vmull.u8 q3, d24, d0
vld1.u8 {d30, d31}, [lr]!
vmull.u8 q4, d25, d0
vmull.u8 q5, d26, d0
vmull.u8 q6, d27, d0
vmull.u8 q7, d28, d0
vmull.u8 q8, d29, d0
vmlal.u8 q1, d24, d1 ;(src_ptr[pixel_step] * Filter[1])
vmlal.u8 q2, d25, d1
vmlal.u8 q3, d26, d1
vmlal.u8 q4, d27, d1
vmlal.u8 q5, d28, d1
vmlal.u8 q6, d29, d1
vmlal.u8 q7, d30, d1
vmlal.u8 q8, d31, d1
subs r12, r12, #1
vqrshrn.u16 d2, q1, #7 ;shift/round/saturate to u8
vqrshrn.u16 d3, q2, #7
vqrshrn.u16 d4, q3, #7
vqrshrn.u16 d5, q4, #7
vqrshrn.u16 d6, q5, #7
vqrshrn.u16 d7, q6, #7
vqrshrn.u16 d8, q7, #7
vqrshrn.u16 d9, q8, #7
vst1.u8 {d2, d3}, [r3]! ;store result
vst1.u8 {d4, d5}, [r3]!
vst1.u8 {d6, d7}, [r3]!
vmov q11, q15
vst1.u8 {d8, d9}, [r3]!
bne vp8e_filt_blk2d_sp16x16_loop_neon
b sub_pixel_variance16x16_neon
;--------------------
firstpass_bfilter16x16_only
mov r2, #4 ;loop counter
sub sp, sp, #528 ;reserve space on stack for temporary storage
vdup.8 d0, d31[0] ;first_pass filter (d0 d1)
vdup.8 d1, d31[4]
mov r3, sp
;First Pass: output_height lines x output_width columns (16x16)
vp8e_filt_blk2d_fpo16x16_loop_neon
vld1.u8 {d2, d3, d4}, [r0], r1 ;load src data
vld1.u8 {d5, d6, d7}, [r0], r1
vld1.u8 {d8, d9, d10}, [r0], r1
vld1.u8 {d11, d12, d13}, [r0], r1
pld [r0]
pld [r0, r1]
pld [r0, r1, lsl #1]
vmull.u8 q7, d2, d0 ;(src_ptr[0] * Filter[0])
vmull.u8 q8, d3, d0
vmull.u8 q9, d5, d0
vmull.u8 q10, d6, d0
vmull.u8 q11, d8, d0
vmull.u8 q12, d9, d0
vmull.u8 q13, d11, d0
vmull.u8 q14, d12, d0
vext.8 d2, d2, d3, #1 ;construct src_ptr[1]
vext.8 d5, d5, d6, #1
vext.8 d8, d8, d9, #1
vext.8 d11, d11, d12, #1
vmlal.u8 q7, d2, d1 ;(src_ptr[0] * Filter[1])
vmlal.u8 q9, d5, d1
vmlal.u8 q11, d8, d1
vmlal.u8 q13, d11, d1
vext.8 d3, d3, d4, #1
vext.8 d6, d6, d7, #1
vext.8 d9, d9, d10, #1
vext.8 d12, d12, d13, #1
vmlal.u8 q8, d3, d1 ;(src_ptr[0] * Filter[1])
vmlal.u8 q10, d6, d1
vmlal.u8 q12, d9, d1
vmlal.u8 q14, d12, d1
subs r2, r2, #1
vqrshrn.u16 d14, q7, #7 ;shift/round/saturate to u8
vqrshrn.u16 d15, q8, #7
vqrshrn.u16 d16, q9, #7
vqrshrn.u16 d17, q10, #7
vqrshrn.u16 d18, q11, #7
vqrshrn.u16 d19, q12, #7
vqrshrn.u16 d20, q13, #7
vst1.u8 {d14, d15}, [r3]! ;store result
vqrshrn.u16 d21, q14, #7
vst1.u8 {d16, d17}, [r3]!
vst1.u8 {d18, d19}, [r3]!
vst1.u8 {d20, d21}, [r3]!
bne vp8e_filt_blk2d_fpo16x16_loop_neon
b sub_pixel_variance16x16_neon
;---------------------
secondpass_bfilter16x16_only
;Second pass: 16x16
;secondpass_filter
sub sp, sp, #528 ;reserve space on stack for temporary storage
add r3, r12, r3, lsl #3
mov r12, #4 ;loop counter
vld1.u32 {d31}, [r3] ;load second_pass filter
vld1.u8 {d22, d23}, [r0], r1 ;load src data
mov r3, sp
vdup.8 d0, d31[0] ;second_pass filter parameters (d0 d1)
vdup.8 d1, d31[4]
vp8e_filt_blk2d_spo16x16_loop_neon
vld1.u8 {d24, d25}, [r0], r1
vmull.u8 q1, d22, d0 ;(src_ptr[0] * Filter[0])
vld1.u8 {d26, d27}, [r0], r1
vmull.u8 q2, d23, d0
vld1.u8 {d28, d29}, [r0], r1
vmull.u8 q3, d24, d0
vld1.u8 {d30, d31}, [r0], r1
vmull.u8 q4, d25, d0
vmull.u8 q5, d26, d0
vmull.u8 q6, d27, d0
vmull.u8 q7, d28, d0
vmull.u8 q8, d29, d0
vmlal.u8 q1, d24, d1 ;(src_ptr[pixel_step] * Filter[1])
vmlal.u8 q2, d25, d1
vmlal.u8 q3, d26, d1
vmlal.u8 q4, d27, d1
vmlal.u8 q5, d28, d1
vmlal.u8 q6, d29, d1
vmlal.u8 q7, d30, d1
vmlal.u8 q8, d31, d1
vqrshrn.u16 d2, q1, #7 ;shift/round/saturate to u8
vqrshrn.u16 d3, q2, #7
vqrshrn.u16 d4, q3, #7
vqrshrn.u16 d5, q4, #7
vqrshrn.u16 d6, q5, #7
vqrshrn.u16 d7, q6, #7
vqrshrn.u16 d8, q7, #7
vqrshrn.u16 d9, q8, #7
vst1.u8 {d2, d3}, [r3]! ;store result
subs r12, r12, #1
vst1.u8 {d4, d5}, [r3]!
vmov q11, q15
vst1.u8 {d6, d7}, [r3]!
vst1.u8 {d8, d9}, [r3]!
bne vp8e_filt_blk2d_spo16x16_loop_neon
b sub_pixel_variance16x16_neon
;----------------------------
;variance16x16
sub_pixel_variance16x16_neon
vmov.i8 q8, #0 ;q8 - sum
vmov.i8 q9, #0 ;q9, q10 - sse
vmov.i8 q10, #0
sub r3, r3, #256
mov r12, #8
sub_pixel_variance16x16_neon_loop
vld1.8 {q0}, [r3]! ;Load up source and reference
vld1.8 {q2}, [r4], r5
vld1.8 {q1}, [r3]!
vld1.8 {q3}, [r4], r5
vsubl.u8 q11, d0, d4 ;diff
vsubl.u8 q12, d1, d5
vsubl.u8 q13, d2, d6
vsubl.u8 q14, d3, d7
vpadal.s16 q8, q11 ;sum
vmlal.s16 q9, d22, d22 ;sse
vmlal.s16 q10, d23, d23
subs r12, r12, #1
vpadal.s16 q8, q12
vmlal.s16 q9, d24, d24
vmlal.s16 q10, d25, d25
vpadal.s16 q8, q13
vmlal.s16 q9, d26, d26
vmlal.s16 q10, d27, d27
vpadal.s16 q8, q14
vmlal.s16 q9, d28, d28
vmlal.s16 q10, d29, d29
bne sub_pixel_variance16x16_neon_loop
vadd.u32 q10, q9, q10 ;accumulate sse
vpaddl.s32 q0, q8 ;accumulate sum
vpaddl.u32 q1, q10
vadd.s64 d0, d0, d1
vadd.u64 d1, d2, d3
vmull.s32 q5, d0, d0
vst1.32 {d1[0]}, [r6] ;store sse
vshr.s32 d10, d10, #8
vsub.s32 d0, d1, d10
add sp, sp, #528
vmov.32 r0, d0[0] ;return
pop {r4-r6,pc}
ENDP
;-----------------
AREA vp8e_bilinear_taps_dat, DATA, READWRITE ;read/write by default
;Data section with name data_area is specified. DCD reserves space in memory for 48 data.
;One word each is reserved. Label filter_coeff can be used to access the data.
;Data address: filter_coeff, filter_coeff+4, filter_coeff+8 ...
_BilinearTaps_coeff_
DCD bilinear_taps_coeff
bilinear_taps_coeff
DCD 128, 0, 112, 16, 96, 32, 80, 48, 64, 64, 48, 80, 32, 96, 16, 112
END
|
; A010122: Continued fraction for sqrt(13).
; 3,1,1,1,1,6,1,1,1,1,6,1,1,1,1,6,1,1,1,1,6,1,1,1,1,6,1,1,1,1,6,1,1,1,1,6,1,1,1,1,6,1,1,1,1,6,1,1,1,1,6,1,1,1,1,6,1,1,1,1,6,1,1,1,1,6,1,1,1,1,6,1,1,1,1,6,1,1,1,1,6,1,1,1,1,6,1,1,1,1,6,1,1,1,1,6,1,1,1,1
seq $0,10152 ; Continued fraction for sqrt(74).
div $0,3
add $0,1
|
; ----------------------------------------------------------------------
; INNER INTERPRETER
IPUSH: DEW SP ; -(SP) = R1H
LDA R1.3
STR SP
DEW SP
LDA R1.2
STR SP
PUSH: DEW SP ; -(SP) = R1L
LDA R1.1
STR SP
DEW SP
LDA R1.0
STR SP
NEXT: LDR IP ; WA = (IP)+
STA WA.0
INW IP
LDR IP
STA WA.1
INW IP
NEXT10: LDR WA ; BC/TMP = (WA)+
STA BC
INW WA
LDR WA
STA TMP
INW WA
INB CLK0 ; Increment the fake clock tick counter
BNE NEXT20 ; :
INB CLK1 ; :
BNE NEXT20 ; :
INB CLK2 ; :
BNE NEXT20 ; :
INB CLK3 ; :
NEXT20: JPR BC ; jump @(BC/TMP)
; ------------------------------
; Push TRUE and FALSE
PUSHT: CLW R1 ; A zero
DEW R1 ; Make it into a -1 i.e. TRUE flag
JPA PUSH
PUSHF: CLW R1 ; A zero
JPA PUSH
; ------------------------------
; Push R1X, MSB as TOS
DPUSH: DEW SP ; -(SP) = R1X
LDA R1.1
STR SP
DEW SP
LDA R1.0
STR SP
DEW SP
LDA R1.3
STR SP
DEW SP
LDA R1.2
STR SP
JPA NEXT
|
#include "Server.h"
#include "Client.h"
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <errno.h>
#include <string>
#include <string.h>
#include <stdexcept>
/**
* @author Seungun-Park
* Create a server socket.
* Start listen
* */
Server::Server()
{
port = atoi(reinterpret_cast<const char*>(getenv("PORT")));
server_fd = socket(PF_INET, SOCK_STREAM, 0);
if(server_fd == -1) throw std::runtime_error(std::string(strerror(errno)));
std::fill(reinterpret_cast<char*>(&server_address),
reinterpret_cast<char*>(&server_address) + sizeof(server_address),
0);
server_address.sin_family = AF_INET;
server_address.sin_addr.s_addr = htonl(INADDR_ANY);
server_address.sin_port = htons(port);
{
int result = bind(server_fd,
reinterpret_cast<const sockaddr*>(&server_address),
sizeof(server_address));
if(result == -1) throw std::runtime_error(std::string(strerror(errno)));
}
backlog = 8;
{
int result = listen(server_fd, backlog);
if(result == -1) throw std::runtime_error(std::string(strerror(errno)));
}
std::cout << "Server Start!" << std::endl;
}
/**
* @author Seungun-Park
* close server socket;
* */
Server::~Server()
{
close(server_fd);
}
/**
* @author Seungun-Park
* accept client.
* if connect client, push client socket into vector and start thread
* */
void Server::run()
{
while(1)
{
struct sockaddr_in client_address;
socklen_t client_address_size = sizeof(client_address);
int client_fd = accept(server_fd,
reinterpret_cast<sockaddr*>(&client_address),
&client_address_size);
if(client_fd == -1) continue;
auto client = std::make_shared<Client>(client_fd, client_address, *this);
clients.push_back(client);
threads.push_back(std::thread(func, clients.back()));
for(std::vector<std::shared_ptr<Client>>::iterator iter = clients.begin();
iter != clients.end();)
{
if(!((*iter)->isRunnable()))
{
iter = clients.erase(iter);
continue;
}
++iter;
}
}
}
void func(std::shared_ptr<Client> client)
{
printf("Connect : %s\n", client->ip());
client->run();
printf("Disconnect : %s\n", client->ip());
}
bool Server::createRoom(Client& c, int bj, std::string bjname)
{
auto room = std::make_shared<Room>(bj, bjname);
rooms.push_back(room);
c.room = room;
write(bj, "create room success", 19);
return true;
}
bool Server::join(Client& c, int fd, std::string name)
{
read(fd, buf, buflen);
int num = atoi(buf);
if(rooms.size() == 0 || num > rooms.size())
{
write(fd, "join failed", 11);
return false;
}
if(rooms[num]->number < 4)
{
(rooms[num]->clients)[rooms[num]->number] = fd;
(rooms[num]->names)[rooms[num]->number] = name;
c.room = rooms[num];
(rooms[num]->number)++;
write(fd, "join success : ", 12);
write(fd, (rooms[num]->getBjname()).c_str(), 8);
return true;
}
else
{
write(fd, "join failed", 11);
return false;
}
}
bool Server::exit()
{
for(std::vector<std::shared_ptr<Room>>::iterator iter = rooms.begin();
iter != rooms.end();)
{
if((*iter)->number == 0)
{
iter = rooms.erase(iter);
continue;
}
++iter;
}
}
|
;
; Copyright (c) 2013 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.
;
EXPORT |vpx_lpf_horizontal_8_neon|
EXPORT |vpx_lpf_vertical_8_neon|
ARM
AREA ||.text||, CODE, READONLY, ALIGN=2
; Currently vpx only works on iterations 8 at a time. The vp8 loop filter
; works on 16 iterations at a time.
;
; void vpx_lpf_horizontal_8_neon(uint8_t *s, int p,
; const uint8_t *blimit,
; const uint8_t *limit,
; const uint8_t *thresh)
; r0 uint8_t *s,
; r1 int p, /* pitch */
; r2 const uint8_t *blimit,
; r3 const uint8_t *limit,
; sp const uint8_t *thresh,
|vpx_lpf_horizontal_8_neon| PROC
push {r4-r5, lr}
vld1.8 {d0[]}, [r2] ; duplicate *blimit
ldr r2, [sp, #12] ; load thresh
add r1, r1, r1 ; double pitch
vld1.8 {d1[]}, [r3] ; duplicate *limit
vld1.8 {d2[]}, [r2] ; duplicate *thresh
sub r3, r0, r1, lsl #1 ; move src pointer down by 4 lines
add r2, r3, r1, lsr #1 ; set to 3 lines down
vld1.u8 {d3}, [r3@64], r1 ; p3
vld1.u8 {d4}, [r2@64], r1 ; p2
vld1.u8 {d5}, [r3@64], r1 ; p1
vld1.u8 {d6}, [r2@64], r1 ; p0
vld1.u8 {d7}, [r3@64], r1 ; q0
vld1.u8 {d16}, [r2@64], r1 ; q1
vld1.u8 {d17}, [r3@64] ; q2
vld1.u8 {d18}, [r2@64], r1 ; q3
sub r3, r3, r1, lsl #1
sub r2, r2, r1, lsl #2
bl vpx_mbloop_filter_neon
vst1.u8 {d0}, [r2@64], r1 ; store op2
vst1.u8 {d1}, [r3@64], r1 ; store op1
vst1.u8 {d2}, [r2@64], r1 ; store op0
vst1.u8 {d3}, [r3@64], r1 ; store oq0
vst1.u8 {d4}, [r2@64], r1 ; store oq1
vst1.u8 {d5}, [r3@64], r1 ; store oq2
pop {r4-r5, pc}
ENDP ; |vpx_lpf_horizontal_8_neon|
; void vpx_lpf_vertical_8_neon(uint8_t *s,
; int pitch,
; const uint8_t *blimit,
; const uint8_t *limit,
; const uint8_t *thresh)
;
; r0 uint8_t *s,
; r1 int pitch,
; r2 const uint8_t *blimit,
; r3 const uint8_t *limit,
; sp const uint8_t *thresh,
|vpx_lpf_vertical_8_neon| PROC
push {r4-r5, lr}
vld1.8 {d0[]}, [r2] ; duplicate *blimit
vld1.8 {d1[]}, [r3] ; duplicate *limit
ldr r3, [sp, #12] ; load thresh
sub r2, r0, #4 ; move s pointer down by 4 columns
vld1.8 {d2[]}, [r3] ; duplicate *thresh
vld1.u8 {d3}, [r2], r1 ; load s data
vld1.u8 {d4}, [r2], r1
vld1.u8 {d5}, [r2], r1
vld1.u8 {d6}, [r2], r1
vld1.u8 {d7}, [r2], r1
vld1.u8 {d16}, [r2], r1
vld1.u8 {d17}, [r2], r1
vld1.u8 {d18}, [r2]
;transpose to 8x16 matrix
vtrn.32 d3, d7
vtrn.32 d4, d16
vtrn.32 d5, d17
vtrn.32 d6, d18
vtrn.16 d3, d5
vtrn.16 d4, d6
vtrn.16 d7, d17
vtrn.16 d16, d18
vtrn.8 d3, d4
vtrn.8 d5, d6
vtrn.8 d7, d16
vtrn.8 d17, d18
sub r2, r0, #3
add r3, r0, #1
bl vpx_mbloop_filter_neon
;store op2, op1, op0, oq0
vst4.8 {d0[0], d1[0], d2[0], d3[0]}, [r2], r1
vst4.8 {d0[1], d1[1], d2[1], d3[1]}, [r2], r1
vst4.8 {d0[2], d1[2], d2[2], d3[2]}, [r2], r1
vst4.8 {d0[3], d1[3], d2[3], d3[3]}, [r2], r1
vst4.8 {d0[4], d1[4], d2[4], d3[4]}, [r2], r1
vst4.8 {d0[5], d1[5], d2[5], d3[5]}, [r2], r1
vst4.8 {d0[6], d1[6], d2[6], d3[6]}, [r2], r1
vst4.8 {d0[7], d1[7], d2[7], d3[7]}, [r2]
;store oq1, oq2
vst2.8 {d4[0], d5[0]}, [r3], r1
vst2.8 {d4[1], d5[1]}, [r3], r1
vst2.8 {d4[2], d5[2]}, [r3], r1
vst2.8 {d4[3], d5[3]}, [r3], r1
vst2.8 {d4[4], d5[4]}, [r3], r1
vst2.8 {d4[5], d5[5]}, [r3], r1
vst2.8 {d4[6], d5[6]}, [r3], r1
vst2.8 {d4[7], d5[7]}, [r3]
pop {r4-r5, pc}
ENDP ; |vpx_lpf_vertical_8_neon|
; void vpx_mbloop_filter_neon();
; This is a helper function for the loopfilters. The invidual functions do the
; necessary load, transpose (if necessary) and store. The function does not use
; registers d8-d15.
;
; Inputs:
; r0-r3, r12 PRESERVE
; d0 blimit
; d1 limit
; d2 thresh
; d3 p3
; d4 p2
; d5 p1
; d6 p0
; d7 q0
; d16 q1
; d17 q2
; d18 q3
;
; Outputs:
; d0 op2
; d1 op1
; d2 op0
; d3 oq0
; d4 oq1
; d5 oq2
|vpx_mbloop_filter_neon| PROC
; filter_mask
vabd.u8 d19, d3, d4 ; m1 = abs(p3 - p2)
vabd.u8 d20, d4, d5 ; m2 = abs(p2 - p1)
vabd.u8 d21, d5, d6 ; m3 = abs(p1 - p0)
vabd.u8 d22, d16, d7 ; m4 = abs(q1 - q0)
vabd.u8 d23, d17, d16 ; m5 = abs(q2 - q1)
vabd.u8 d24, d18, d17 ; m6 = abs(q3 - q2)
; only compare the largest value to limit
vmax.u8 d19, d19, d20 ; m1 = max(m1, m2)
vmax.u8 d20, d21, d22 ; m2 = max(m3, m4)
vabd.u8 d25, d6, d4 ; m7 = abs(p0 - p2)
vmax.u8 d23, d23, d24 ; m3 = max(m5, m6)
vabd.u8 d26, d7, d17 ; m8 = abs(q0 - q2)
vmax.u8 d19, d19, d20
vabd.u8 d24, d6, d7 ; m9 = abs(p0 - q0)
vabd.u8 d27, d3, d6 ; m10 = abs(p3 - p0)
vabd.u8 d28, d18, d7 ; m11 = abs(q3 - q0)
vmax.u8 d19, d19, d23
vabd.u8 d23, d5, d16 ; a = abs(p1 - q1)
vqadd.u8 d24, d24, d24 ; b = abs(p0 - q0) * 2
; abs () > limit
vcge.u8 d19, d1, d19
; only compare the largest value to thresh
vmax.u8 d25, d25, d26 ; m4 = max(m7, m8)
vmax.u8 d26, d27, d28 ; m5 = max(m10, m11)
vshr.u8 d23, d23, #1 ; a = a / 2
vmax.u8 d25, d25, d26 ; m4 = max(m4, m5)
vqadd.u8 d24, d24, d23 ; a = b + a
vmax.u8 d20, d20, d25 ; m2 = max(m2, m4)
vmov.u8 d23, #1
vcge.u8 d24, d0, d24 ; a > blimit
vcgt.u8 d21, d21, d2 ; (abs(p1 - p0) > thresh)*-1
vcge.u8 d20, d23, d20 ; flat
vand d19, d19, d24 ; mask
vcgt.u8 d23, d22, d2 ; (abs(q1 - q0) > thresh)*-1
vand d20, d20, d19 ; flat & mask
vmov.u8 d22, #0x80
vorr d23, d21, d23 ; hev
; This instruction will truncate the "flat & mask" masks down to 4 bits
; each to fit into one 32 bit arm register. The values are stored in
; q10.64[0].
vshrn.u16 d30, q10, #4
vmov.u32 r4, d30[0] ; flat & mask 4bits
adds r5, r4, #1 ; Check for all 1's
; If mask and flat are 1's for all vectors, then we only need to execute
; the power branch for all vectors.
beq power_branch_only
cmp r4, #0 ; Check for 0, set flag for later
; mbfilter() function
; filter() function
; convert to signed
veor d21, d7, d22 ; qs0
veor d24, d6, d22 ; ps0
veor d25, d5, d22 ; ps1
veor d26, d16, d22 ; qs1
vmov.u8 d27, #3
vsub.s8 d28, d21, d24 ; ( qs0 - ps0)
vqsub.s8 d29, d25, d26 ; filter = clamp(ps1-qs1)
vmull.s8 q15, d28, d27 ; 3 * ( qs0 - ps0)
vand d29, d29, d23 ; filter &= hev
vaddw.s8 q15, q15, d29 ; filter + 3 * (qs0 - ps0)
vmov.u8 d29, #4
; filter = clamp(filter + 3 * ( qs0 - ps0))
vqmovn.s16 d28, q15
vand d28, d28, d19 ; filter &= mask
vqadd.s8 d30, d28, d27 ; filter2 = clamp(filter+3)
vqadd.s8 d29, d28, d29 ; filter1 = clamp(filter+4)
vshr.s8 d30, d30, #3 ; filter2 >>= 3
vshr.s8 d29, d29, #3 ; filter1 >>= 3
vqadd.s8 d24, d24, d30 ; op0 = clamp(ps0 + filter2)
vqsub.s8 d21, d21, d29 ; oq0 = clamp(qs0 - filter1)
; outer tap adjustments: ++filter1 >> 1
vrshr.s8 d29, d29, #1
vbic d29, d29, d23 ; filter &= ~hev
vqadd.s8 d25, d25, d29 ; op1 = clamp(ps1 + filter)
vqsub.s8 d26, d26, d29 ; oq1 = clamp(qs1 - filter)
; If mask and flat are 0's for all vectors, then we only need to execute
; the filter branch for all vectors.
beq filter_branch_only
; If mask and flat are mixed then we must perform both branches and
; combine the data.
veor d24, d24, d22 ; *f_op0 = u^0x80
veor d21, d21, d22 ; *f_oq0 = u^0x80
veor d25, d25, d22 ; *f_op1 = u^0x80
veor d26, d26, d22 ; *f_oq1 = u^0x80
; At this point we have already executed the filter branch. The filter
; branch does not set op2 or oq2, so use p2 and q2. Execute the power
; branch and combine the data.
vmov.u8 d23, #2
vaddl.u8 q14, d6, d7 ; r_op2 = p0 + q0
vmlal.u8 q14, d3, d27 ; r_op2 += p3 * 3
vmlal.u8 q14, d4, d23 ; r_op2 += p2 * 2
vbif d0, d4, d20 ; op2 |= p2 & ~(flat & mask)
vaddw.u8 q14, d5 ; r_op2 += p1
vbif d1, d25, d20 ; op1 |= f_op1 & ~(flat & mask)
vqrshrn.u16 d30, q14, #3 ; r_op2
vsubw.u8 q14, d3 ; r_op1 = r_op2 - p3
vsubw.u8 q14, d4 ; r_op1 -= p2
vaddw.u8 q14, d5 ; r_op1 += p1
vaddw.u8 q14, d16 ; r_op1 += q1
vbif d2, d24, d20 ; op0 |= f_op0 & ~(flat & mask)
vqrshrn.u16 d31, q14, #3 ; r_op1
vsubw.u8 q14, d3 ; r_op0 = r_op1 - p3
vsubw.u8 q14, d5 ; r_op0 -= p1
vaddw.u8 q14, d6 ; r_op0 += p0
vaddw.u8 q14, d17 ; r_op0 += q2
vbit d0, d30, d20 ; op2 |= r_op2 & (flat & mask)
vqrshrn.u16 d23, q14, #3 ; r_op0
vsubw.u8 q14, d3 ; r_oq0 = r_op0 - p3
vsubw.u8 q14, d6 ; r_oq0 -= p0
vaddw.u8 q14, d7 ; r_oq0 += q0
vbit d1, d31, d20 ; op1 |= r_op1 & (flat & mask)
vaddw.u8 q14, d18 ; oq0 += q3
vbit d2, d23, d20 ; op0 |= r_op0 & (flat & mask)
vqrshrn.u16 d22, q14, #3 ; r_oq0
vsubw.u8 q14, d4 ; r_oq1 = r_oq0 - p2
vsubw.u8 q14, d7 ; r_oq1 -= q0
vaddw.u8 q14, d16 ; r_oq1 += q1
vbif d3, d21, d20 ; oq0 |= f_oq0 & ~(flat & mask)
vaddw.u8 q14, d18 ; r_oq1 += q3
vbif d4, d26, d20 ; oq1 |= f_oq1 & ~(flat & mask)
vqrshrn.u16 d6, q14, #3 ; r_oq1
vsubw.u8 q14, d5 ; r_oq2 = r_oq1 - p1
vsubw.u8 q14, d16 ; r_oq2 -= q1
vaddw.u8 q14, d17 ; r_oq2 += q2
vaddw.u8 q14, d18 ; r_oq2 += q3
vbif d5, d17, d20 ; oq2 |= q2 & ~(flat & mask)
vqrshrn.u16 d7, q14, #3 ; r_oq2
vbit d3, d22, d20 ; oq0 |= r_oq0 & (flat & mask)
vbit d4, d6, d20 ; oq1 |= r_oq1 & (flat & mask)
vbit d5, d7, d20 ; oq2 |= r_oq2 & (flat & mask)
bx lr
power_branch_only
vmov.u8 d27, #3
vmov.u8 d21, #2
vaddl.u8 q14, d6, d7 ; op2 = p0 + q0
vmlal.u8 q14, d3, d27 ; op2 += p3 * 3
vmlal.u8 q14, d4, d21 ; op2 += p2 * 2
vaddw.u8 q14, d5 ; op2 += p1
vqrshrn.u16 d0, q14, #3 ; op2
vsubw.u8 q14, d3 ; op1 = op2 - p3
vsubw.u8 q14, d4 ; op1 -= p2
vaddw.u8 q14, d5 ; op1 += p1
vaddw.u8 q14, d16 ; op1 += q1
vqrshrn.u16 d1, q14, #3 ; op1
vsubw.u8 q14, d3 ; op0 = op1 - p3
vsubw.u8 q14, d5 ; op0 -= p1
vaddw.u8 q14, d6 ; op0 += p0
vaddw.u8 q14, d17 ; op0 += q2
vqrshrn.u16 d2, q14, #3 ; op0
vsubw.u8 q14, d3 ; oq0 = op0 - p3
vsubw.u8 q14, d6 ; oq0 -= p0
vaddw.u8 q14, d7 ; oq0 += q0
vaddw.u8 q14, d18 ; oq0 += q3
vqrshrn.u16 d3, q14, #3 ; oq0
vsubw.u8 q14, d4 ; oq1 = oq0 - p2
vsubw.u8 q14, d7 ; oq1 -= q0
vaddw.u8 q14, d16 ; oq1 += q1
vaddw.u8 q14, d18 ; oq1 += q3
vqrshrn.u16 d4, q14, #3 ; oq1
vsubw.u8 q14, d5 ; oq2 = oq1 - p1
vsubw.u8 q14, d16 ; oq2 -= q1
vaddw.u8 q14, d17 ; oq2 += q2
vaddw.u8 q14, d18 ; oq2 += q3
vqrshrn.u16 d5, q14, #3 ; oq2
bx lr
filter_branch_only
; TODO(fgalligan): See if we can rearange registers so we do not need to
; do the 2 vswp.
vswp d0, d4 ; op2
vswp d5, d17 ; oq2
veor d2, d24, d22 ; *op0 = u^0x80
veor d3, d21, d22 ; *oq0 = u^0x80
veor d1, d25, d22 ; *op1 = u^0x80
veor d4, d26, d22 ; *oq1 = u^0x80
bx lr
ENDP ; |vpx_mbloop_filter_neon|
END
|
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r14
push %rax
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0x15b4f, %rbp
nop
xor $27537, %r10
movb (%rbp), %al
nop
nop
nop
nop
nop
sub $60904, %rbp
lea addresses_normal_ht+0x1380f, %rbx
nop
nop
nop
cmp %rbp, %rbp
mov (%rbx), %r14
nop
nop
nop
nop
nop
xor %r10, %r10
lea addresses_A_ht+0x1b54f, %rsi
lea addresses_UC_ht+0x2e4f, %rdi
nop
nop
nop
nop
nop
xor %rbx, %rbx
mov $87, %rcx
rep movsl
nop
nop
nop
nop
nop
dec %rax
lea addresses_UC_ht+0x26d7, %rbx
nop
nop
nop
add $22300, %rcx
mov (%rbx), %eax
nop
nop
nop
cmp %r10, %r10
lea addresses_WC_ht+0x10c4f, %r14
nop
sub $56207, %rbp
mov (%r14), %si
nop
nop
nop
nop
cmp $30663, %r14
lea addresses_normal_ht+0x1144f, %rsi
nop
nop
nop
nop
and $64315, %rbx
movups (%rsi), %xmm6
vpextrq $1, %xmm6, %rcx
nop
nop
nop
inc %rbx
lea addresses_D_ht+0x78f, %rax
nop
nop
nop
nop
inc %rdi
movups (%rax), %xmm7
vpextrq $0, %xmm7, %r10
sub %rsi, %rsi
lea addresses_normal_ht+0x1a58f, %rcx
nop
nop
sub %rax, %rax
and $0xffffffffffffffc0, %rcx
movaps (%rcx), %xmm3
vpextrq $1, %xmm3, %rbp
sub $19943, %rsi
lea addresses_A_ht+0x1bacf, %rax
nop
nop
nop
nop
sub $41228, %rcx
movb (%rax), %r10b
nop
nop
nop
nop
nop
sub %rsi, %rsi
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %rax
pop %r14
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r13
push %rbx
push %rcx
push %rdi
push %rsi
// Store
lea addresses_WC+0x924f, %rsi
clflush (%rsi)
nop
nop
nop
dec %r12
movw $0x5152, (%rsi)
nop
cmp $43780, %rsi
// Store
lea addresses_PSE+0xf34f, %rdi
clflush (%rdi)
nop
nop
nop
xor %r12, %r12
mov $0x5152535455565758, %rbx
movq %rbx, %xmm1
movups %xmm1, (%rdi)
xor %rbx, %rbx
// Store
lea addresses_A+0x804f, %rdi
nop
nop
nop
nop
add %r11, %r11
movw $0x5152, (%rdi)
nop
nop
nop
nop
xor %r12, %r12
// Store
lea addresses_PSE+0x48b7, %rsi
xor %r12, %r12
mov $0x5152535455565758, %rcx
movq %rcx, (%rsi)
sub %rdi, %rdi
// Store
lea addresses_WT+0x12317, %rbx
nop
nop
nop
nop
and $25442, %rsi
movl $0x51525354, (%rbx)
nop
sub $1418, %r12
// Load
lea addresses_PSE+0x1dc4f, %rdi
nop
nop
nop
nop
nop
sub $22532, %r13
vmovups (%rdi), %ymm3
vextracti128 $1, %ymm3, %xmm3
vpextrq $0, %xmm3, %rcx
nop
nop
cmp $21463, %rbx
// Store
lea addresses_RW+0x20cf, %rbx
clflush (%rbx)
nop
nop
inc %rdi
movl $0x51525354, (%rbx)
nop
nop
and $8887, %rbx
// Faulty Load
lea addresses_PSE+0x1dc4f, %r12
nop
nop
and $11089, %rcx
vmovups (%r12), %ymm1
vextracti128 $0, %ymm1, %xmm1
vpextrq $0, %xmm1, %rbx
lea oracles, %r12
and $0xff, %rbx
shlq $12, %rbx
mov (%r12,%rbx,1), %rbx
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r13
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_PSE', 'same': True, 'size': 4, 'congruent': 0, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_WC', 'same': False, 'size': 2, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_PSE', 'same': False, 'size': 16, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_A', 'same': False, 'size': 2, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_PSE', 'same': False, 'size': 8, 'congruent': 3, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WT', 'same': False, 'size': 4, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_PSE', 'same': True, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_RW', 'same': False, 'size': 4, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_PSE', 'same': True, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_A_ht', 'same': False, 'size': 1, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 8, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_UC_ht', 'same': False, 'size': 4, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 2, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 16, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D_ht', 'same': False, 'size': 16, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 16, 'congruent': 3, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A_ht', 'same': False, 'size': 1, 'congruent': 6, 'NT': False, 'AVXalign': False}, '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
*/
|
; Copyright 2016 Philipp Oppermann. See the README.md
; file at the top-level directory of this distribution.
;
; Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
; http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
; <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
; option. This file may not be copied, modified, or distributed
; except according to those terms.
global start
extern long_mode_start
section .text
bits 32
start:
mov esp, stack_top
; Move Multiboot info pointer to edi to pass it to the kernel. We must not
; modify the `edi` register until the kernel it called.
mov edi, ebx
call check_multiboot
call check_cpuid
call check_long_mode
call set_up_page_tables
call enable_paging
call set_up_SSE
; load the 64-bit GDT
lgdt [gdt64.pointer]
; update selectors
mov ax, gdt64.data
mov ss, ax
mov ds, ax
mov es, ax
jmp gdt64.code:long_mode_start
set_up_page_tables:
; recursive map P4
mov eax, p4_table
or eax, 0b11 ; present + writable
mov [p4_table + 511 * 8], eax
; map first P4 entry to P3 table
mov eax, p3_table
or eax, 0b11 ; present + writable
mov [p4_table], eax
; map first P3 entry to P2 table
mov eax, p2_table
or eax, 0b11 ; present + writable
mov [p3_table], eax
; map each P2 entry to a huge 2MiB page
mov ecx, 0 ; counter variable
.map_p2_table:
; map ecx-th P2 entry to a huge page that starts at address (2MiB * ecx)
mov eax, 0x200000 ; 2MiB
mul ecx ; start address of ecx-th page
or eax, 0b10000011 ; present + writable + huge
mov [p2_table + ecx * 8], eax ; map ecx-th entry
inc ecx ; increase counter
cmp ecx, 512 ; if counter == 512, the whole P2 table is mapped
jne .map_p2_table ; else map the next entry
ret
enable_paging:
; load P4 to cr3 register (cpu uses this to access the P4 table)
mov eax, p4_table
mov cr3, eax
; enable PAE-flag in cr4 (Physical Address Extension)
mov eax, cr4
or eax, 1 << 5
mov cr4, eax
; set the long mode bit in the EFER MSR (model specific register)
mov ecx, 0xC0000080
rdmsr
or eax, 1 << 8
wrmsr
; enable paging in the cr0 register
mov eax, cr0
or eax, 1 << 31
mov cr0, eax
ret
; Prints `ERR: ` and the given error code to screen and hangs.
; parameter: error code (in ascii) in al
error:
mov dword [0xb8000], 0x4f524f45
mov dword [0xb8004], 0x4f3a4f52
mov dword [0xb8008], 0x4f204f20
mov byte [0xb800a], al
hlt
; Throw error 0 if eax doesn't contain the Multiboot 2 magic value (0x36d76289).
check_multiboot:
cmp eax, 0x36d76289
jne .no_multiboot
ret
.no_multiboot:
mov al, "0"
jmp error
; Throw error 1 if the CPU doesn't support the CPUID command.
check_cpuid:
; Check if CPUID is supported by attempting to flip the ID bit (bit 21) in
; the FLAGS register. If we can flip it, CPUID is available.
; Copy FLAGS in to EAX via stack
pushfd
pop eax
; Copy to ECX as well for comparing later on
mov ecx, eax
; Flip the ID bit
xor eax, 1 << 21
; Copy EAX to FLAGS via the stack
push eax
popfd
; Copy FLAGS back to EAX (with the flipped bit if CPUID is supported)
pushfd
pop eax
; Restore FLAGS from the old version stored in ECX (i.e. flipping the ID bit
; back if it was ever flipped).
push ecx
popfd
; Compare EAX and ECX. If they are equal then that means the bit wasn't
; flipped, and CPUID isn't supported.
cmp eax, ecx
je .no_cpuid
ret
.no_cpuid:
mov al, "1"
jmp error
; Throw error 2 if the CPU doesn't support Long Mode.
check_long_mode:
; test if extended processor info in available
mov eax, 0x80000000 ; implicit argument for cpuid
cpuid ; get highest supported argument
cmp eax, 0x80000001 ; it needs to be at least 0x80000001
jb .no_long_mode ; if it's less, the CPU is too old for long mode
; use extended info to test if long mode is available
mov eax, 0x80000001 ; argument for extended processor info
cpuid ; returns various feature bits in ecx and edx
test edx, 1 << 29 ; test if the LM-bit is set in the D-register
jz .no_long_mode ; If it's not set, there is no long mode
ret
.no_long_mode:
mov al, "2"
jmp error
; Check for SSE and enable it. If it's not supported throw error "a".
set_up_SSE:
; check for SSE
mov eax, 0x1
cpuid
test edx, 1<<25
jz .no_SSE
; enable SSE
mov eax, cr0
and ax, 0xFFFB ; clear coprocessor emulation CR0.EM
or ax, 0x2 ; set coprocessor monitoring CR0.MP
mov cr0, eax
mov eax, cr4
or ax, 3 << 9 ; set CR4.OSFXSR and CR4.OSXMMEXCPT at the same time
mov cr4, eax
ret
.no_SSE:
mov al, "a"
jmp error
section .bss
align 4096
p4_table:
resb 4096
p3_table:
resb 4096
p2_table:
resb 4096
stack_bottom:
resb 4096 * 2
stack_top:
section .rodata
gdt64:
dq 0 ; zero entry
.code: equ $ - gdt64 ; new
dq (1<<44) | (1<<47) | (1<<41) | (1<<43) | (1<<53) ; code segment
.data: equ $ - gdt64 ; new
dq (1<<44) | (1<<47) | (1<<41) ; data segment
.pointer:
dw $ - gdt64 - 1
dq gdt64
|
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r15
push %rax
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_normal_ht+0xf33c, %r15
nop
nop
nop
nop
sub %r11, %r11
movups (%r15), %xmm5
vpextrq $1, %xmm5, %rbp
nop
cmp $60187, %rbp
lea addresses_UC_ht+0x956c, %rax
and $13289, %rcx
mov $0x6162636465666768, %rdx
movq %rdx, %xmm7
vmovups %ymm7, (%rax)
nop
nop
and $37564, %rax
lea addresses_WC_ht+0x6992, %rsi
lea addresses_WT_ht+0x45ec, %rdi
clflush (%rsi)
nop
nop
inc %rbp
mov $50, %rcx
rep movsq
nop
nop
add %rax, %rax
lea addresses_WT_ht+0x184ec, %r11
nop
dec %rsi
movb (%r11), %al
nop
sub %r15, %r15
lea addresses_D_ht+0x2cb4, %rax
and %rsi, %rsi
movb $0x61, (%rax)
nop
nop
nop
nop
nop
inc %rdi
lea addresses_D_ht+0xa1ec, %rsi
lea addresses_WC_ht+0x151d2, %rdi
nop
nop
nop
nop
cmp $55577, %r15
mov $15, %rcx
rep movsq
nop
nop
nop
nop
add $54031, %rsi
lea addresses_WT_ht+0x1bc6c, %rdx
nop
nop
nop
nop
nop
sub %rax, %rax
mov (%rdx), %si
nop
nop
inc %rdi
lea addresses_UC_ht+0x4cfc, %rsi
lea addresses_A_ht+0x169c, %rdi
nop
nop
nop
add $4512, %r15
mov $23, %rcx
rep movsq
inc %rbp
lea addresses_normal_ht+0x4aec, %r15
nop
nop
nop
nop
nop
inc %rax
vmovups (%r15), %ymm5
vextracti128 $0, %ymm5, %xmm5
vpextrq $1, %xmm5, %rbp
nop
nop
nop
inc %rbp
lea addresses_normal_ht+0xbe6c, %rsi
lea addresses_normal_ht+0x13e6c, %rdi
nop
nop
nop
nop
nop
add %r15, %r15
mov $69, %rcx
rep movsb
nop
nop
nop
and $31545, %r15
lea addresses_normal_ht+0xdb98, %rax
nop
nop
nop
xor %rsi, %rsi
movb $0x61, (%rax)
nop
nop
nop
cmp $38571, %rcx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r15
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r15
push %rax
push %rbp
push %rdx
push %rsi
// Store
mov $0xfec, %rsi
add $61268, %rax
movw $0x5152, (%rsi)
nop
nop
add $5834, %rax
// Store
lea addresses_D+0x20ec, %rsi
nop
nop
nop
and $8179, %r13
movb $0x51, (%rsi)
nop
nop
nop
inc %r15
// Faulty Load
lea addresses_A+0x92ec, %r15
cmp %r10, %r10
mov (%r15), %rdx
lea oracles, %rax
and $0xff, %rdx
shlq $12, %rdx
mov (%rax,%rdx,1), %rdx
pop %rsi
pop %rdx
pop %rbp
pop %rax
pop %r15
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0, 'same': False, 'type': 'addresses_A'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 4, 'same': False, 'type': 'addresses_P'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': True, 'size': 1, 'congruent': 8, 'same': False, 'type': 'addresses_D'}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0, 'same': True, 'type': 'addresses_A'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 1, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 7, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'STOR'}
{'src': {'congruent': 1, 'same': False, 'type': 'addresses_WC_ht'}, 'dst': {'congruent': 7, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM'}
{'src': {'NT': True, 'AVXalign': False, 'size': 1, 'congruent': 8, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 3, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'STOR'}
{'src': {'congruent': 7, 'same': False, 'type': 'addresses_D_ht'}, 'dst': {'congruent': 1, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM'}
{'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 6, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 4, 'same': True, 'type': 'addresses_UC_ht'}, 'dst': {'congruent': 4, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM'}
{'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 11, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 7, 'same': False, 'type': 'addresses_normal_ht'}, 'dst': {'congruent': 7, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'REPM'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 2, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'STOR'}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
#ifndef BOOST_IS_PLACEHOLDER_HPP_INCLUDED
#define BOOST_IS_PLACEHOLDER_HPP_INCLUDED
// MS compatible compilers support #pragma once
#if defined( _MSC_VER ) && ( _MSC_VER >= 1020 )
# pragma once
#endif
// is_placeholder.hpp - TR1 is_placeholder metafunction
//
// Copyright (c) 2006 Peter Dimov
//
// Distributed under the Boost Software License, Version 1.0.
//
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
namespace mars_boost {} namespace boost = mars_boost; namespace mars_boost
{
template< class T > struct is_placeholder
{
enum _vt { value = 0 };
};
} // namespace mars_boost
#endif // #ifndef BOOST_IS_PLACEHOLDER_HPP_INCLUDED
|
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
(c) Copyright GeoWorks 1995. All Rights Reserved.
GEOWORKS CONFIDENTIAL
PROJECT: GEOS
MODULE: CommonUI/CGadget
FILE: copenTextBuild.asm
ROUTINES:
Name Description
---- -----------
MTD MSG_META_INITIALIZE Initialize an OpenLook text display object.
INT MapAndStoreEditableTextFont
Replaces the text object's font with the
EditableFont stored in dgroup for the given
object.
INT SetCharParaAttrsFromHints
Sets character and paragraph attributes.
Various hints cause storageFlags to be
turned on or off, and all cause a word to
be stored in VTI_paraAttrRuns or
VTI_charAttrRuns.
GLB SetTextMargins Sets the text margins for editable text.
INT TranslateGenericFonts Translates generic font labels to actual
fonts. If a real font and size is
specified, leaves it alone.
MTD MSG_OL_PLACE_IN_VIEW Causes text object to no longer appear on
its visual parent, but instead, to appear
inside of a view. This operation is
essentially a SPEC_BUILD operation.
MTD MSG_SPEC_BUILD Create the visual display of this specific
object.
INT TextMakeDefaultFocus Create the visual display of this specific
object.
INT TextGeneralConsumerMode Create the visual display of this specific
object.
INT TextNeverMakeScrollable Create the visual display of this specific
object.
INT TextAlpha Create the visual display of this specific
object.
INT TextUppercase Create the visual display of this specific
object.
INT TextNumeric Create the visual display of this specific
object.
INT TextSignedNumeric Create the visual display of this specific
object.
INT TextSignedDecimal Create the visual display of this specific
object.
INT TextFloatDecimal Create the visual display of this specific
object.
INT TextAlphaNumeric Create the visual display of this specific
object.
INT TextLegalFilenames Create the visual display of this specific
object.
INT TextLegalDosFilenames Create the visual display of this specific
object.
INT TextLegalDosVolumeNames Create the visual display of this specific
object.
INT TextLegalDosPath Create the visual display of this specific
object.
INT TextDate Create the visual display of this specific
object.
INT TextTime Create the visual display of this specific
object.
INT TextDashedAlphaNumeric Create the visual display of this specific
object.
INT TextAllowColumnBreaks Create the visual display of this specific
object.
INT TextNoSpaces Create the visual display of this specific
object.
INT TextAllowSpaces Create the visual display of this specific
object.
INT TextNormalAscii Create the visual display of this specific
object.
INT TextDosCharacterSet Create the visual display of this specific
object.
INT TextWhiteWashColor Create the visual display of this specific
object.
INT TextWashColor Create the visual display of this specific
object.
INT TextRunsItemGroup Create the visual display of this specific
object.
INT TextFrame Create the visual display of this specific
object.
INT SetItemGroupDestAndStatusMsg
Sets up destination and status message of
item group, so it will be sent back to us.
INT ObjMsgCall Sets up destination and status message of
item group, so it will be sent back to us.
INT SetupDelayedMode Sets up delayed mode status for the object.
INT TextProperty Sets up delayed mode status for the object.
INT TextNotProperty Sets up delayed mode status for the object.
INT TextAutoHyphenate Allow auto hyphenation in the text object.
INT TextSelectText Select the text...
INT TextCursorAtStart Position the cursor at the start of the
text.
INT TextCursorAtEnd Position the cursor at the end of the text.
GLB TextAllowSmartQuotes Allow smart quotes in this object
GLB TextAllowUndo Allow smart quotes in this object
INT TextDoNotUseMoniker Handles DO_NOT_USE_MONIKER hint for
OLTextClass.
INT SetDefaultBGColor Set the default background color based on
the position of the text object.
MTD MSG_SPEC_SCAN_GEOMETRY_HINTS
Scans geometry hints.
INT TextExpandWidth Scans geometry hints.
INT TextExpandHeight Scans geometry hints.
INT RemoveComposite Removes composite from the picture before
building a view.
MTD MSG_SPEC_UNBUILD Make sure text object releases focus &
exclusive grabs, since text object is being
visually unbuilt. Then do see if we need to
set an associated view or composite as
well.
MTD MSG_SPEC_SET_NOT_USABLE Handles being set not usable.
INT CreateView If not already created, create a generic
view & content object for text to appear
in. Initialize them.
INT SetMinMaxSizeHints Sets minimum and maximum size hints on the
view, if needed.
INT AddArgsToSizeHint Adds arguments to size hint, if needed.
Any non-zero width or height will be added
as a size argument if there isn't something
already specified in a hint.
INT CreateComposite If not already created, create a generic
interaction for text to appear in.
Initialize it.
MTD MSG_SPEC_GET_SPECIFIC_VIS_OBJECT
Returns specific object used for this
generic object.
REVISION HISTORY:
Name Date Description
---- ---- -----------
dlitwin 10/10/94 Broken out of copenText.asm
DESCRIPTION:
Implementation of the SPUI text display class (OLTextClass).
$Id: copenTextBuild.asm,v 1.2 98/03/11 05:51:46 joon Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GadgetBuild segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLTextInitialize
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Initialize an OpenLook text display object.
CALLED BY: via MSG_META_INITIALIZE.
PASS: ds:*si = instance ptr.
es = class segment.
ax = MSG_META_INITIALIZE.
RETURN: nothing
DESTROYED: ax, cx, dx
PSEUDO CODE/STRATEGY:
Build the visual instance.
- Use the user specified state block, if one exists.
- Translate generic fonts into specific font ids and point sizes.
- Mark object as needing recalculation, so that when it is realized
it will get word-wrapped correctly.
- Copy flags from generic attributes into visual instance flags.
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jcw 10/13/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLTextInitialize method dynamic OLTextClass, MSG_META_INITIALIZE
; Make sure vis built out
EC < call ECCheckGenTextObject >
mov di, offset OLTextClass
call ObjCallSuperNoLock
mov di, ds:[si] ;
mov bx, di ;
add di, ds:[di].Gen_offset ; get ptr to Generic data
add bx, ds:[bx].Vis_offset ; get ptr to Vis, VisTextIns.
; copy OD from Gen to Vis
movdw ds:[bx].VTI_output, ds:[di].GTXI_destination, ax
;
; Need a text chunk handle.
;
mov ax, ds:[di].GTXI_text ; Get handle of text
tst ax ; See if null handle
je OLTDI_noTextSpecified ; if not, don't need to set up.
push ax ; Save users text.
mov ax, ds:[bx].VTI_text ; get allocated null chunk
tst ax ;
jz OLTDI_noTextAllocd ; skip if doesn't exist
call LMemFree ; else free it.
mov di, ds:[si] ;
mov bx, di ;
add di, ds:[di].Gen_offset ; get ptr to Generic data
add bx, ds:[bx].Vis_offset ; get ptr to Vis, VisTextIns.
OLTDI_noTextAllocd: ;
pop ax ; & replace:
mov ds:[bx].VTI_text, ax ; Store chunk of text
jmp common
OLTDI_noTextSpecified: ;
call ObjMarkDirty
common:
mov ax, ds:[bx].VTI_text ; Copy text handle into gen
mov ds:[di].GTXI_text, ax ; instance, in case none was
; specified by the user.
mov di, ds:[si] ;
mov bx, di ;
add di, ds:[di].Gen_offset ; get ptr to Generic data
add bx, ds:[bx].Vis_offset ; get ptr to Vis, VisTextIns.
;
; Init the margins. Non-editable text needs no margins.
;
if DRAW_STYLES
;
; always have a gutter for draw styles
;
mov ds:[bx].VTI_lrMargin, 1
mov ds:[bx].VTI_tbMargin, 1
else
mov ds:[bx].VTI_lrMargin, 0
mov ds:[bx].VTI_tbMargin, 0
endif
;
; Init the rest of the thing.
;
mov ax, ds:[di].GTXI_maxLength ; Copy the max length
mov ds:[bx].VTI_maxLength, ax ;
test ds:[di].GI_attrs, mask GA_TARGETABLE
jz notTargetable
ornf ds:[bx].VTI_state, mask VTS_TARGETABLE
notTargetable:
;
; Now initialize the flags and attributes in the visual object.
; Definitely not editable (this is a display object).
; Default to not selectable, unless otherwise specified.
; These will be set in the SpecBuild.
;
and ds:[bx].VTI_state, not (mask VTS_EDITABLE or \
mask VTS_SELECTABLE)
;
; Mark as using standard move/resize.
;
or ds:[bx].VI_geoAttrs, mask VGA_USE_VIS_SET_POSITION
;
; Check for single line display, and if so, OR that bit into the
; text-state flags for the vis instance.
;
mov al, ds:[di].GTXI_attrs
test al, mask GTA_SINGLE_LINE_TEXT
jz notOneLine ;
or ds:[bx].VTI_state, mask VTS_ONE_LINE
notOneLine:
;
; Use 50% pattern if initially indeterminate.
;
test ds:[di].GTXI_stateFlags, mask GTSF_INDETERMINATE
jz notIndeterminate
or ds:[bx].VTI_features, mask VTF_USE_50_PCT_TEXT_MASK
notIndeterminate:
;
; Check for no word-wrap, and if so, OR that bit into the
; text-state flags for the vis instance.
;
test al, mask GTA_NO_WORD_WRAPPING
jz OLTDI_wordWrap
ornf ds:[bx].VTI_features, mask VTF_NO_WORD_WRAPPING
OLTDI_wordWrap: ;
if DRAW_STYLES
;
; default draw style - flat
;
andnf ds:[bx].OLTDI_moreState, not mask TDSS_DRAW_STYLE
if (DS_FLAT ne 0)
ornf ds:[bx].OLTDI_moreState, DS_FLAT shl offset TDSS_DRAW_STYLE
endif
;
; default to framed if scrolling
;
test ds:[di].GTXI_attrs, mask GTA_INIT_SCROLLING
jz notScrolling
call SetTextMargins
notScrolling:
endif
; copy vardata stuff if it exists
mov ax, ATTR_GEN_TEXT_DOES_NOT_ACCEPT_INK
mov di, ATTR_VIS_TEXT_DOES_NOT_ACCEPT_INK
call copyVarData
mov ax, ATTR_GEN_TEXT_CUSTOM_FILTER
mov di, ATTR_VIS_TEXT_CUSTOM_FILTER
call copyVarData
mov ax,ATTR_GEN_TEXT_SEND_CONTEXT_NOTIFICATIONS_EVEN_IF_NOT_FOCUSED
mov di,ATTR_VIS_TEXT_SEND_CONTEXT_NOTIFICATIONS_EVEN_IF_NOT_FOCUSED
call copyVarData
mov ax, ATTR_GEN_TEXT_TYPE_RUNS
mov di, ATTR_VIS_TEXT_TYPE_RUNS
call copyVarData
mov ax, ATTR_GEN_TEXT_GRAPHIC_RUNS
mov di, ATTR_VIS_TEXT_GRAPHIC_RUNS
call copyVarData
mov ax, ATTR_GEN_TEXT_STYLE_ARRAY
mov di, ATTR_VIS_TEXT_STYLE_ARRAY
call copyVarData
mov ax, ATTR_GEN_TEXT_NAME_ARRAY
mov di, ATTR_VIS_TEXT_NAME_ARRAY
call copyVarData
mov ax, ATTR_GEN_TEXT_EXTENDED_FILTER
mov di, ATTR_VIS_TEXT_EXTENDED_FILTER
call copyVarData
mov ax, ATTR_GEN_TEXT_DO_NOT_INTERACT_WITH_SEARCH_CONTROL
mov di, ATTR_VIS_TEXT_DO_NOT_INTERACT_WITH_SEARCH_CONTROL
call copyVarData
mov ax, ATTR_GEN_TEXT_DONT_BEEP_ON_INSERTION_ERROR
mov di, ATTR_VIS_TEXT_DONT_BEEP_ON_INSERTION_ERROR
call copyVarData
mov ax, ATTR_GEN_TEXT_CURSOR_NO_FOCUS
mov di, ATTR_VIS_TEXT_CURSOR_NO_FOCUS
call copyVarData
if PZ_PCGEOS
mov ax, ATTR_GEN_TEXT_NO_FEP
mov di, ATTR_VIS_TEXT_NO_FEP
call copyVarData
endif
mov ax, ATTR_GEN_TEXT_NO_CURSOR
mov di, ATTR_VIS_TEXT_NO_CURSOR
call copyVarData
if DBCS_PCGEOS
mov ax, ATTR_GEN_TEXT_ALLOW_FULLWIDTH_DIGITS
mov di, ATTR_VIS_TEXT_ALLOW_FULLWIDTH_DIGITS
call copyVarData
endif
mov ax, ATTR_GEN_TEXT_TYPE_RUNS
mov di, offset VTI_storageFlags
mov cl, mask VTSF_TYPES
call setStorageFlag
mov ax, ATTR_GEN_TEXT_GRAPHIC_RUNS
mov cl, mask VTSF_GRAPHICS
call setStorageFlag
mov ax, ATTR_GEN_TEXT_STYLE_ARRAY
mov cl, mask VTSF_STYLES
call setStorageFlag
call SetCharParaAttrsFromHints
; Returns cl = non-zero if char attrs modified by hints,
; ch = non-zero if para attrs modified by hints
OLTDI_handleEditable:
;
; If not read-only, let's set up all the editable stuff that needs
; setting up.
;
mov di, ds:[si]
mov bx, di
add di, ds:[di].Gen_offset
add bx, ds:[bx].Vis_offset
test ds:[di].GI_attrs, mask GA_READ_ONLY
jnz exit ;is read only, done.
;
; See if we are supposed to change the font since this is an
; editable instance of a text object (JimG - 3/8/94)
;
tst cl ; Char attrs modified by hints?
jnz noEditableText ; Yes, skip this completely.
mov ax, segment dgroup
mov es, ax
tst es:[editableTextFontID] ; Editable font specified?
jz noEditableText ; No, skip this.
call MapAndStoreEditableTextFont
; bx, di pointer MAY BE INVALID at this point, but
; SetTextMargins will redereference these points first thing.
noEditableText:
call SetTextMargins
;
; Make editable and selectable.
;
or ds:[bx].VTI_state, mask VTS_SELECTABLE or \
mask VTS_EDITABLE
or ds:[bx].OLTDI_moreState, mask TDSS_SELECTABLE
if DRAW_STYLES
;
; default draw style for editable - 3D lowered
;
andnf ds:[bx].OLTDI_moreState, not mask TDSS_DRAW_STYLE
ornf ds:[bx].OLTDI_moreState, DS_LOWERED shl offset TDSS_DRAW_STYLE
endif
mov di, ds:[si]
add di, ds:[di].OLText_offset
ornf ds:[di].OLTDI_specState, mask TDSS_EDITABLE
mov di, ds:[si] ;
add di, ds:[di].Gen_offset ; ds:di <- ptr to gen instance.
test ds:[di].GTXI_attrs, mask GTA_USE_TAB_FOR_NAVIGATION
jz exit ; tabs don't navigate, branch
;
; Else we'll filter TAB's.
;
or ds:[bx].VTI_filters, mask VTF_NO_TABS
exit:
ret ; <-- RETURN
; very local subroutines.
copyVarData:
call ObjVarFindData
jnc doesNotExist
mov dx, ds:[bx]
mov cx, size word
mov_tr ax, di
call ObjVarAddData
mov ds:[bx], dx
doesNotExist:
retn
setStorageFlag:
; ax = hint, cl = VTSF_...bit to set, di = vis byte flag to set
push bx
call ObjVarFindData
jnc 10$
mov bx, ds:[si]
add bx, ds:[bx].Vis_offset
add bx, di ; use bx instead of di to store
or {byte} ds:[bx], cl ; (preserves di)
10$:
pop bx
retn
OLTextInitialize endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
MapAndStoreEditableTextFont
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Replaces the text object's font with the EditableFont
stored in dgroup for the given object.
CALLED BY: OLTextInitialize
PASS: *ds:si - instance pointer
ds:bx - pointer to Vis instance data
RETURN: nothing
DESTROYED: es, di, ax, bx, cx, dx
SIDE EFFECTS:
WARNING: This routine MAY resize LMem and/or object blocks, moving
them on the heap and invalidating stored segment pointers
to them.
PSEUDO CODE/STRATEGY:
Get a default CharAttr, and then fill in our info. Then
attempt to map it back to a VisTextDefaultCharAttr if possible.
It will then replace VTI_charAttrRuns for that object. This
may have to allocate storage if the font does not fit the
profile of a VisTextDefaultCharAttr, or remove previously allocated
storage if it is a default, but the previous font was not.
All allocation/freeing is done within the object's memory block.
REVISION HISTORY:
Name Date Description
---- ---- -----------
JimG 3/ 2/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
MapAndStoreEditableTextFont proc near
class VisTextClass
charAttr local VisTextCharAttr
uses ds,si
.enter
; load segment of dgroup into es
mov ax, segment dgroup
mov es, ax
; Get default char attrs
push bp
mov ax, VIS_TEXT_INITIAL_CHAR_ATTR
lea bp, ss:[charAttr]
call TextMapDefaultCharAttr
pop bp
; Stuff in our data
mov cx, es:[editableTextFontsize]
mov ss:[charAttr].VTCA_pointSize.WBF_int, cx
clr ss:[charAttr].VTCA_pointSize.WBF_frac
mov cx, es:[editableTextFontID]
mov ss:[charAttr].VTCA_fontID, cx
; Try to map to a DefaultCharAttr
; If carry was set then the return value is a defaultcharattr.
push bp
lea bp, ss:[charAttr]
call TextFindDefaultCharAttr ; ax <- VisTextDefaultCharAttr
pop bp
jnc notDefaultCharAttr
; This mapped to a DefaultCharAttr. Store the new CharAttr
xchg ax, ds:[bx].VTI_charAttrRuns
test ds:[bx].VTI_storageFlags, mask VTSF_DEFAULT_CHAR_ATTR
jnz done ; do not have to free anything
; Free the old VisTextCharAttr
ornf ds:[bx].VTI_storageFlags, mask VTSF_DEFAULT_CHAR_ATTR
call LMemFree ; ds = seg, ax = handle
jmp done
; Okay, this did not map to a DefaultCharAttr, so we have to
; store a VisTextCharAttr structure in the object. If one
; already existed, we'll just use it, otherwise, we'll
; allocate our own.
notDefaultCharAttr:
test ds:[bx].VTI_storageFlags, mask VTSF_DEFAULT_CHAR_ATTR
jz fillCharAttr
; Allocate a new lmem
mov al, mask OCF_IGNORE_DIRTY
mov cx, size VisTextCharAttr
call LMemAlloc
; Redereference VIS instance data
mov bx, ds:[si]
add bx, ds:[bx].Vis_offset
mov ds:[bx].VTI_charAttrRuns, ax
andnf ds:[bx].VTI_storageFlags, not mask VTSF_DEFAULT_CHAR_ATTR
; Fill the char attr with our local copy
fillCharAttr:
segmov es, ds, cx
mov si, ds:[bx].VTI_charAttrRuns
mov di, ds:[si] ; es:di = destination
segmov ds, ss, cx
lea si, ss:[charAttr] ; ds:si = source
CheckHack < ((size VisTextCharAttr) / 2) * 2 eq (size VisTextCharAttr)>>
mov cx, (size VisTextCharAttr)/2
rep movsw
done:
.leave
ret
MapAndStoreEditableTextFont endp
COMMENT @----------------------------------------------------------------------
ROUTINE: SetCharParaAttrsFromHints
SYNOPSIS: Sets character and paragraph attributes. Various hints
cause storageFlags to be turned on or off, and all cause
a word to be stored in VTI_paraAttrRuns or VTI_charAttrRuns.
CALLED BY: OLTextInitialize
PASS: *ds:si -- object
RETURN: cl - Non-zero if char attrs changed, zero otherwise
ch - Non-zero if para attrs changed, zero otherwise
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Chris 7/ 8/92 Initial version
JimG 3/14/94 Added return values, cl & ch.
------------------------------------------------------------------------------@
SetCharParaAttrsFromHints proc near
clr cx ; clear char & para attr
; changed flags
EC < call ECCheckGenTextObject >
mov di, ds:[si]
add di, ds:[di].Vis_offset
;
; Multiple char attr runs, set multiple bit, clear default bit, and
; store in VTI_charAttrRuns.
;
mov ax, ATTR_GEN_TEXT_MULTIPLE_CHAR_ATTR_RUNS
call ObjVarFindData
jnc 10$
or ds:[di].VTI_storageFlags, mask VTSF_MULTIPLE_CHAR_ATTRS
jmp short notDefaultCharAttr
10$:
;
; Single char attr run, clear default bit, and
; store in VTI_charAttrRuns.
;
mov ax, ATTR_GEN_TEXT_CHAR_ATTR
call ObjVarFindData
jnc 20$
notDefaultCharAttr:
and ds:[di].VTI_storageFlags, not mask VTSF_DEFAULT_CHAR_ATTR
jmp short copyCharAttr
20$:
;
; Default char attr run, store in VTI_charAttrRuns.
;
mov ax, ATTR_GEN_TEXT_DEFAULT_CHAR_ATTR
call ObjVarFindData
jnc 30$
;
; Make as default in the event VisTextInitialize thought it wasn't
;
ornf ds:[di].VTI_storageFlags, mask VTSF_DEFAULT_CHAR_ATTR
copyCharAttr:
mov ax, {word} ds:[bx]
mov ds:[di].VTI_charAttrRuns, ax
not cl ; set flag - char attr changed
30$:
;
; Multiple para attr runs, set multiple bit, clear default bit, and
; store in VTI_paraAttrRuns.
;
mov ax, ATTR_GEN_TEXT_MULTIPLE_PARA_ATTR_RUNS
call ObjVarFindData
jnc 40$
or ds:[di].VTI_storageFlags, mask VTSF_MULTIPLE_PARA_ATTRS
jmp short notDefaultParaAttr
40$:
;
; Single para attr run, clear default bit, and
; store in VTI_paraAttrRuns.
;
mov ax, ATTR_GEN_TEXT_PARA_ATTR
call ObjVarFindData
jnc 50$
notDefaultParaAttr:
and ds:[di].VTI_storageFlags, not mask VTSF_DEFAULT_PARA_ATTR
jmp short copyParaAttr
50$:
;
; Single para attr run, clear default bit, and
; store in VTI_paraAttrRuns.
;
mov ax, ATTR_GEN_TEXT_DEFAULT_PARA_ATTR
call ObjVarFindData
jnc 60$
copyParaAttr:
mov ax, {word} ds:[bx]
mov ds:[di].VTI_paraAttrRuns, ax
not ch ; set flag - para attr changed
60$:
ret
SetCharParaAttrsFromHints endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SetTextMargins
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Sets the text margins for editable text.
CALLED BY: GLOBAL
PASS: *ds:si - text object
RETURN: ds:di -- Gen instance
ds:bx -- Vis instance
DESTROYED: ax
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
atw 2/19/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SetTextMargins proc far
.enter
EC < call ECCheckGenTextObject >
mov bx, ds:[si] ; ds:bx <- ptr to vis instance.
mov di, bx
add bx, ds:[bx].Vis_offset ;
add di, ds:[di].Gen_offset ;ds:[di] -- GenInstance
;
; In motif, editable text is always in a frame; in open look, only if
; it's not one-line text. Open look one-line editable objects will
; have a top/bottom margin, to make room for an underline.
;
if (not _DUI) ; don't make larger on DUI
call SysGetPenMode
tst ax
jz 5$ ;Use PEN_FRAME_TEXT_MARGIN if we are
; in pen mode and this is a single
; line text edit object. May be
; overriden by code in SPEC_BUILD.
test ds:[di].GTXI_attrs, mask GTA_SINGLE_LINE_TEXT
jz 5$
mov ax, HINT_TEXT_DO_NOT_MAKE_LARGER_ON_PEN_SYSTEMS
push bx
call ObjVarFindData
pop bx
mov al, PEN_FRAME_TEXT_MARGIN
jnc 7$
5$:
endif ; (not _DUI)
mov al, FRAME_TEXT_MARGIN
call OpenCheckIfCGA ;smaller in CGA 11/18/92 cbh
jnc 7$
if ((FRAME_TEXT_MARGIN - CGA_FRAME_TEXT_MARGIN) eq 1)
dec al
else
mov al, CGA_FRAME_TEXT_MARGIN
endif
7$:
mov ds:[bx].VTI_tbMargin, al
CUAS < mov ds:[bx].VTI_lrMargin, FRAME_TEXT_MARGIN >
OLS < test ds:[di].GTXI_attrs, mask GTA_SINGLE_LINE_TEXT >
OLS < jnz 10$ ; single line, no frame >
OLS < mov ds:[bx].VTI_lrMargin, CHISELED_FRAME_TEXT_MARGIN >
OLS < mov ds:[bx].VTI_tbMargin, CHISELED_FRAME_TEXT_MARGIN >
mov di, ds:[si] ; ds:di <- ptr to specific.
add di, ds:[di].OLText_offset
ornf ds:[di].OLTDI_specState, mask TDSS_IN_FRAME
OLS < 10$: >
.leave
ret
SetTextMargins endp
GadgetBuild ends
GadgetBuild segment resource
COMMENT @----------------------------------------------------------------------
METHOD: OLTextPlaceInView -- MSG_OL_PLACE_IN_VIEW
for OLTextClass
DESCRIPTION: Causes text object to no longer appear on its visual
parent, but instead, to appear inside of a view. This
operation is essentially a SPEC_BUILD operation.
PASS:
*ds:si - instance data
es - segment of OLTextClass
ax - MSG_OL_PLACE_IN_VIEW
cx - ?
dx - ?
bp - ?
RETURN:
carry - ?
ax, cx, dx, bp - ?
DESTROYED:
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 6/89 Initial version
Doug 9/89 Redone for new spec build methodology
------------------------------------------------------------------------------@
OLTextPlaceInView method dynamic OLTextClass, \
MSG_OL_PLACE_IN_VIEW
EC < call ECCheckGenTextObject >
EC < test ds:[di].OLTDI_specState, mask TDSS_IN_VIEW >
EC < ERROR_NZ OL_ERROR >
;
; First, remove the gadget exclusive until we can get the text object
; into the view.
;
mov dx, si ;pass OD
mov cx, ds:[LMBH_handle]
mov ax, MSG_VIS_RELEASE_GADGET_EXCL ;release the gadget exclusive
call VisCallParent ;while parent comp is destroyed
;
; If we currently have the focus, we'll set a bit to tell us to
; restore the gadget exclusive to the text object when everything is
; re-built. Hopefully VTISF_IS_FOCUS will correspond to when we have
; the focus.
;
mov di, ds:[si] ;point to instance
add di, ds:[di].Vis_offset ;ds:[di] -- VisInstance
test ds:[di].VTI_intSelFlags, mask VTISF_IS_FOCUS
jz 10$ ;doesn't have focus, branch
or ds:[di].OLTDI_specState, mask TDSS_NEEDS_GADGET_EXCL
call MetaReleaseFocusExclLow ;release the focus
10$:
;
; Next, visually close down the text object, if it is realized
;
call VisSetNotRealized
;
; And clear out the area behind it, as per MSG_SPEC_SET_NOT_USABLE
; handler, so that invalidations happen correctly.
;
mov ax, MSG_VIS_INVALIDATE
call ObjCallInstanceNoLock
; THEN, Tear out of visual tree...
mov cx, ds:[LMBH_handle] ;
mov dx, si ;
clr bp ; No need to make dirty
mov ax, MSG_VIS_REMOVE_CHILD ; (will be removed next time)
call VisCallParent ;
;
;
; so that we can rebuild it inside the view.
;
; Request to be placed in view
mov di, ds:[si] ;
add di, ds:[di].Gen_offset ;
or ds:[di].GTXI_attrs, mask GTA_INIT_SCROLLING
; DO VIS BUILD to get it there.
clr bp ; Not a tree build.
call VisSendSpecBuild ; set up enabled flag & do the
; spec build
;
; Let's make the effort to do an update now. It didn't get done
; elsewhere.
;
mov cl, mask VOF_GEOMETRY_INVALID ; mark the thing invalid
mov dl, VUM_NOW ;
mov ax, MSG_VIS_MARK_INVALID ;
call GenCallParent ; should cause some ruckus
;
mov ax, MSG_VIS_RECREATE_CACHED_GSTATES
; Force text object to redefine
call ObjCallInstanceNoLock ; it's gstate since it is now
; in a window.
OLTDPIV_Done: ;
ret ;
OLTextPlaceInView endm
GadgetBuild ends
Build segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLTextSpecBuild
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Create the visual display of this specific object.
CALLED BY: External.
PASS: ds:*si = instance.
ax = MSG_SPEC_BUILD.
bp = VisBulidFlags
RETURN: nothing
DESTROYED:
PSEUDO CODE/STRATEGY:
If not yet vis built {
if currently IN_VIEW, or marked as INIT_SCROLLING {
Build view, & spec build it;
} else do standard spec build;
Set colors for text object;
Scan hints, to set focus stuff;
}
A few comments about the visual building of the text object:
First, if the text object is not in a view, the spec build proceeds in the
straight default fashion. IF, however, the text object should appear in
a view, then we do some gymnastics. What we do is this: We create a
GenView possessing a GenContent, & attach it generically (upward link only?)
alongside the gen text object. We then create the visual tree for the text
object by visibly building the view & adding the text object to the content
object, visually. This leaves the text object generically in the same place,
while yielding a visual tree in which the text object is in a view. Since
all other visual methods beside SPEC_BUILD travel along the visible tree,
this arrangement should work, with geometry & image methods proceeding with
the new visible tree.
KNOWN BUGS/SIDE EFFECTS/IDEAS:
NOTE: The GenView is currently generically attached w/full linkage. This
makes it somewhat easier to spec build, although this may be considered
somewhat unclean as far as the generic world goes. We may want to
change this.
REVISION HISTORY:
Name Date Description
---- ---- -----------
jcw 7/13/89 Initial version
doug 9/22/89 New, revised spec build methodology
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLTextSpecBuild method dynamic OLTextClass, MSG_SPEC_BUILD
EC < call ECCheckGenTextObject >
test ds:[di].OLTDI_specState, mask TDSS_EDITABLE
jz noKeyboard
call CheckIfKeyboardRequired
jnc noKeyboard
if _DUI
;
; set keyboard type before bringing it up
;
call SetKeyboardType
endif
push bp
mov ax, MSG_SPEC_GUP_QUERY
mov cx, SGQT_BRING_UP_KEYBOARD
call GenCallParent
pop bp
noKeyboard:
call VisCheckIfSpecBuilt ; Check for already vis-built.
;
jnc 10$ ;
jmp OLTDVB_Done ; quit if so.
10$: ;
call VisSpecBuildSetEnabledState ; make sure this happens.
segmov es, cs ; setup es:di to be ptr to
; Hint handler table
call SetDefaultBGColor ; Set colors (pass cx)
mov di, offset cs:MkrVarDataHandler
mov ax, length (cs:MkrVarDataHandler)
call OpenScanVarData ;
;
; Check for no-frame. (kept out of main hint handlers, so this will
; take precedence over other hints) -cbh 2/ 1/93
;
if DRAW_STYLES
;
; disallow frame for 3d text displays (from PL96.380)
;
call Build_DerefVisSpecDI
mov ax, ds:[di].OLTDI_moreState
andnf ax, mask TDSS_DRAW_STYLE
.assert (DS_FLAT eq 0)
jz allowFrame
test ds:[di].OLTDI_specState, mask TDSS_EDITABLE
jz frameOff ; 3d display, frame off
allowFrame:
endif
mov ax, HINT_TEXT_NO_FRAME
call ObjVarFindData
jnc 12$
call Build_DerefVisSpecDI
frameOff::
and ds:[di].OLTDI_specState, not mask TDSS_IN_FRAME
if DRAW_STYLES
;
; undo frame margins also, ensuring we always have a gutter
;
mov ds:[di].VTI_lrMargin, 1
mov ds:[di].VTI_tbMargin, 1
endif
12$:
;
; Setup geometry stuff.
;
call OLTextScanGeometryHints
;
; Check for already in a view.
;
call Build_DerefVisSpecDI
if TEXT_DISPLAY_FOCUSABLE
;
; make room in margins for focus indicator, if non-editable
; (editable shows focus with cursor) and focusable-text-display
; hint present
;
test ds:[di].OLTDI_specState, mask TDSS_EDITABLE
jnz notDisplay
test ds:[di].OLTDI_moreState, mask TDSS_FOCUSABLE
jz notDisplay
tst ds:[di].VTI_lrMargin
jnz haveGutter1
inc ds:[di].VTI_lrMargin ; no gutter yet, make space btwn
inc ds:[di].VTI_tbMargin ; focus ring and text
haveGutter1:
if TEXT_DISPLAY_FOCUS_WIDTH eq 1
inc ds:[di].VTI_lrMargin
inc ds:[di].VTI_tbMargin
else
add ds:[di].VTI_lrMargin, TEXT_DISPLAY_FOCUS_WIDTH
add ds:[di].VTI_tbMargin, TEXT_DISPLAY_FOCUS_WIDTH
endif
notDisplay:
endif ; TEXT_DISPLAY_FOCUSABLE
if DRAW_STYLES
;
; make room for draw style insets (only for raised and lowered)
;
mov ax, ds:[di].OLTDI_moreState
andnf ax, mask TDSS_DRAW_STYLE
cmp ax, DS_LOWERED shl offset TDSS_DRAW_STYLE
je addInset
cmp ax, DS_RAISED shl offset TDSS_DRAW_STYLE
jne noInset
addInset:
tst ds:[di].VTI_lrMargin
jnz haveGutter2
inc ds:[di].VTI_lrMargin ; no gutter yet, make space btwn
inc ds:[di].VTI_tbMargin ; focus ring and text
haveGutter2:
if DRAW_STYLE_INSET_WIDTH eq 1
inc ds:[di].VTI_lrMargin
inc ds:[di].VTI_tbMargin
else
add ds:[di].VTI_lrMargin, DRAW_STYLE_INSET_WIDTH
add ds:[di].VTI_tbMargin, DRAW_STYLE_INSET_WIDTH
endif
noInset:
endif ; DRAW_STYLES
test ds:[di].OLTDI_specState, mask TDSS_IN_VIEW
jnz OLTDVB_InView ; branch if already in a view.
;
mov di, ds:[si] ;
add di, ds:[di].Gen_offset ;
;
; Check for scrollbar desired.
;
test ds:[di].GTXI_attrs, mask GTA_INIT_SCROLLING
jnz OLTDVB_InView ; yes, go put in view.
;
; Not a view object; let's see if we need to be in a composite.
;
tst ds:[di].GI_visMoniker ; see if there's a vis moniker
jz CheckMarginsNeeded ; nope, don't need comp, branch
mov di, ds:[si] ; point to instance
add di, ds:[di].Vis_offset ; ds:[di] -- SpecInstance
test ds:[di].OLTDI_specState, mask TDSS_NO_MONIKER
jnz CheckMarginsNeeded ; no moniker, branch
test ds:[di].OLTDI_specState, mask TDSS_IN_VIEW
jnz CheckMarginsNeeded ; already in view, don't need
; a comp to display moniker
PopIntoComposite:
call CreateComposite ; create composite to be in
; and build it.
jmp short OLTDVB_Misc ; continue on our way.
CheckMarginsNeeded:
;
; Do the vis-build for the object.
;
mov di, offset OLTextClass
mov ax, segment OLTextClass
mov es, ax
mov ax, MSG_SPEC_BUILD
CallSuper MSG_SPEC_BUILD ; build it please.
jmp short OLTDVB_Misc ; & skip to misc stuff to
; finish up with.
OLTDVB_InView: ;
call RemoveComposite ; remove composite, if there
; bl holds margin flags now
call CreateView ; Ensure we have GenView,
; GenContent objects inited
; Vis build the sucker.
OLTDVB_Misc: ;
call SetupDelayedMode
;Check for default action behavior
mov ax, MSG_OL_WIN_IS_DEFAULT_ACTION_NAVIGATE_TO_NEXT_FIELD
call CallOLWin ; carry set if so
jnc notNavigateToNextField
call Build_DerefVisSpecDI
ornf ds:[di].OLTDI_moreState, \
mask TDSS_DEFAULT_ACTION_IS_NAVIGATE_TO_NEXT_FIELD
notNavigateToNextField:
checkSelectable:
;
; Make selectable if editable or an attribute is present.
;
mov di, ds:[si] ;point to instance
add di, ds:[di].Gen_offset
test ds:[di].GI_attrs, mask GA_READ_ONLY
jz OLTDVB_selectable
mov ax, ATTR_GEN_TEXT_SELECTABLE
call ObjVarFindData
jnc OLTDVB_notSelectable
OLTDVB_selectable:
mov di, ds:[si] ;point to instance
add di, ds:[di].Vis_offset
test ds:[di].VI_attrs, mask VA_FULLY_ENABLED
jz OLTDVB_notSelectable ; not enabled, not selectable.
or ds:[di].VTI_state, mask VTS_SELECTABLE
or ds:[di].OLTDI_moreState, mask TDSS_SELECTABLE
OLTDVB_notSelectable: ;
;
; FINALLY, PROCESS HINTS. The hints requesting that the window be
; made the default focus or target are processed here, by generating
; generic methods that are sent to this object. (But not if the
; object isn't selectable! -cbh 12/ 8/92)
;
mov di, ds:[si] ;(deference, added 9/11/95 cbh)
add di, ds:[di].Vis_offset
test ds:[di].OLTDI_moreState, mask TDSS_SELECTABLE
jz OLTDVB_Done
call ScanFocusTargetHintHandlers
OLTDVB_Done: ;
;
; Mark the dialog box applyable if we're coming up modified, via
; the queue, to ensure the dialog box is all set up.
; -cbh 2/ 9/93
;
call Build_DerefGenDI
test ds:[di].GTXI_stateFlags, mask GTSF_MODIFIED
jz makeNotOverlapping
mov ax, MSG_GEN_MAKE_APPLYABLE
mov bx, ds:[LMBH_handle]
mov di, mask MF_FORCE_QUEUE or mask MF_INSERT_AT_FRONT
call ObjMessage
makeNotOverlapping:
;
; Set a flag in the OLCtrl that we can't be overlapping objects.
; -cbh 2/22/93
;
call OpenCheckIfBW ;not B/W, don't sweat
jnc exit
call SpecSetFlagsOnAllCtrlParents ;sets CANT_OVERLAP_KIDS
exit:
if BUBBLE_DIALOGS and (not (_DUI))
; Look for OLDialogWinClass vis parent
;
mov cx, segment OLDialogWinClass
mov dx, offset OLDialogWinClass
mov ax, MSG_VIS_VUP_FIND_OBJECT_OF_CLASS
call ObjCallInstanceNoLock
jnc notABubble
; We have such a parent. Lock it down and look at its private parts
; and check if it is a POPUP.
; Hack not for the squeamish.
;
push si
movdw bxsi, cxdx
call ObjSwapLock
mov di, ds:[si]
add di, ds:[di].Vis_offset
test ds:[di].OLPWI_flags, mask OLPWF_IS_POPUP
pushf
call ObjSwapUnlock
popf
pop si
jz notABubble
; Hey, we're a bubble! Set the bit so we can check later.
;
mov di, ds:[si]
add di, ds:[di].Vis_offset
ornf ds:[di].OLTDI_moreState, mask TDSS_WIN_IS_POPUP
notABubble:
endif ;BUBBLE_DIALOGS and (not (_DUI))
ret
OLTextSpecBuild endm
if _GCM ;----------------------------------------------------------------------
MkrVarDataHandler VarDataHandler \
<HINT_DO_NOT_USE_MONIKER, offset TextDoNotUseMoniker>,
<HINT_TEXT_AUTO_HYPHENATE, offset TextAutoHyphenate>,
<HINT_TEXT_SELECT_TEXT, offset TextSelectText>,
<HINT_TEXT_CURSOR_AT_START, offset TextCursorAtStart>,
<HINT_TEXT_CURSOR_AT_END, offset TextCursorAtEnd>,
<HINT_TEXT_ALLOW_SMART_QUOTES, offset TextAllowSmartQuotes>,
<HINT_TEXT_ALLOW_UNDO, offset TextAllowUndo>,
<ATTR_GEN_TEXT_ALPHA, offset TextAlpha>,
<ATTR_GEN_TEXT_NUMERIC, offset TextNumeric>,
<ATTR_GEN_TEXT_SIGNED_NUMERIC, offset TextSignedNumeric>,
<ATTR_GEN_TEXT_SIGNED_DECIMAL, offset TextSignedDecimal>,
<ATTR_GEN_TEXT_FLOAT_DECIMAL, offset TextFloatDecimal>,
<ATTR_GEN_TEXT_ALPHA_NUMERIC, offset TextAlphaNumeric>,
<ATTR_GEN_TEXT_LEGAL_FILENAMES, offset TextLegalFilenames>,
<ATTR_GEN_TEXT_LEGAL_DOS_FILENAMES, offset TextLegalDosFilenames>,
<ATTR_GEN_TEXT_LEGAL_DOS_PATH, offset TextLegalDosPath>,
<ATTR_GEN_TEXT_NO_SPACES, offset TextNoSpaces>,
<ATTR_GEN_TEXT_ALLOW_SPACES, offset TextAllowSpaces>,
<HINT_TEXT_WASH_COLOR, offset TextWashColor>,
<HINT_TEXT_WHITE_WASH_COLOR, offset TextWhiteWashColor>,
<ATTR_GEN_TEXT_DATE, offset TextDate>,
<ATTR_GEN_TEXT_TIME, offset TextTime>,
<ATTR_GEN_TEXT_DASHED_ALPHA_NUMERIC, offset TextDashedAlphaNumeric>,
<ATTR_GEN_TEXT_NORMAL_ASCII, offset TextNormalAscii>,
<HINT_DEFAULT_FOCUS, offset TextMakeDefaultFocus>,
<HINT_GENERAL_CONSUMER_MODE, offset TextGeneralConsumerMode>,
<ATTR_GEN_TEXT_LEGAL_DOS_VOLUME_NAMES, offset TextLegalDosVolumeNames>,
<ATTR_GEN_TEXT_DOS_CHARACTER_SET, offset TextDosCharacterSet>,
<ATTR_GEN_TEXT_RUNS_ITEM_GROUP, offset TextRunsItemGroup>,
<ATTR_GEN_TEXT_MAKE_UPPERCASE, offset TextUppercase>,
<ATTR_GEN_TEXT_ALLOW_COLUMN_BREAKS, offset TextAllowColumnBreaks>,
<ATTR_GEN_TEXT_NEVER_MAKE_SCROLLABLE, offset TextNeverMakeScrollable>,
<HINT_TEXT_FRAME, offset TextFrame>
else ; not _GCM ------------------------------------------------------------
MkrVarDataHandler VarDataHandler \
<HINT_DO_NOT_USE_MONIKER, offset TextDoNotUseMoniker>,
<HINT_TEXT_AUTO_HYPHENATE, offset TextAutoHyphenate>,
<HINT_TEXT_SELECT_TEXT, offset TextSelectText>,
<HINT_TEXT_CURSOR_AT_START, offset TextCursorAtStart>,
<HINT_TEXT_CURSOR_AT_END, offset TextCursorAtEnd>,
<HINT_TEXT_ALLOW_SMART_QUOTES, offset TextAllowSmartQuotes>,
<HINT_TEXT_ALLOW_UNDO, offset TextAllowUndo>,
<ATTR_GEN_TEXT_ALPHA, offset TextAlpha>,
<ATTR_GEN_TEXT_NUMERIC, offset TextNumeric>,
<ATTR_GEN_TEXT_SIGNED_NUMERIC, offset TextSignedNumeric>,
<ATTR_GEN_TEXT_SIGNED_DECIMAL, offset TextSignedDecimal>,
<ATTR_GEN_TEXT_FLOAT_DECIMAL, offset TextFloatDecimal>,
<ATTR_GEN_TEXT_ALPHA_NUMERIC, offset TextAlphaNumeric>,
<ATTR_GEN_TEXT_LEGAL_FILENAMES, offset TextLegalFilenames>,
<ATTR_GEN_TEXT_LEGAL_DOS_FILENAMES, offset TextLegalDosFilenames>,
<ATTR_GEN_TEXT_LEGAL_DOS_PATH, offset TextLegalDosPath>,
<ATTR_GEN_TEXT_NO_SPACES, offset TextNoSpaces>,
<ATTR_GEN_TEXT_ALLOW_SPACES, offset TextAllowSpaces>,
<HINT_TEXT_WASH_COLOR, offset TextWashColor>,
<HINT_TEXT_WHITE_WASH_COLOR, offset TextWhiteWashColor>,
<ATTR_GEN_TEXT_DATE, offset TextDate>,
<ATTR_GEN_TEXT_TIME, offset TextTime>,
<ATTR_GEN_TEXT_DASHED_ALPHA_NUMERIC, offset TextDashedAlphaNumeric>,
<ATTR_GEN_TEXT_NORMAL_ASCII, offset TextNormalAscii>,
<HINT_DEFAULT_FOCUS, offset TextMakeDefaultFocus>,
<ATTR_GEN_TEXT_LEGAL_DOS_VOLUME_NAMES, offset TextLegalDosVolumeNames>,
<ATTR_GEN_TEXT_DOS_CHARACTER_SET, offset TextDosCharacterSet>,
<ATTR_GEN_TEXT_RUNS_ITEM_GROUP, offset TextRunsItemGroup>,
<ATTR_GEN_TEXT_MAKE_UPPERCASE, offset TextUppercase>,
<ATTR_GEN_TEXT_ALLOW_COLUMN_BREAKS, offset TextAllowColumnBreaks>,
<ATTR_GEN_TEXT_NEVER_MAKE_SCROLLABLE, offset TextNeverMakeScrollable>,
if TEXT_DISPLAY_FOCUSABLE
<HINT_TEXT_DISPLAY_FOCUSABLE, offset TextDisplayFocusable>,
endif
if DRAW_STYLES
<HINT_DRAW_STYLE_FLAT, offset TextDrawStyleFlat>,
<HINT_DRAW_STYLE_3D_LOWERED, offset TextDrawStyleLowered>,
<HINT_DRAW_STYLE_3D_RAISED, offset TextDrawStyleRaised>,
endif
<HINT_TEXT_FRAME, offset TextFrame>
endif ; if _GCM -------------------------------------------------------------
;--------
if TEXT_DISPLAY_FOCUSABLE
TextDisplayFocusable proc far
call Build_DerefVisSpecDI
ORNF ds:[di].OLTDI_moreState, mask TDSS_FOCUSABLE
ret
TextDisplayFocusable endp
endif
if DRAW_STYLES
TextDrawStyleFlat proc far
mov ax, DS_FLAT shl offset TDSS_DRAW_STYLE
GOTO DrawStyleCommon
TextDrawStyleFlat endp
TextDrawStyleLowered proc far
mov ax, DS_LOWERED shl offset TDSS_DRAW_STYLE
GOTO DrawStyleCommon
TextDrawStyleLowered endp
TextDrawStyleRaised proc far
mov ax, DS_RAISED shl offset TDSS_DRAW_STYLE
FALL_THRU DrawStyleCommon
TextDrawStyleRaised endp
DrawStyleCommon proc far
call Build_DerefVisSpecDI
andnf ds:[di].OLTDI_moreState, not mask TDSS_DRAW_STYLE
ornf ds:[di].OLTDI_moreState, ax
ret
DrawStyleCommon endp
endif
TextMakeDefaultFocus proc far
call Build_DerefVisSpecDI
ORNF ds:[di].OLTDI_moreState, mask TDSS_MAKE_DEFAULT_FOCUS
ret
TextMakeDefaultFocus endp
if _GCM
TextGeneralConsumerMode proc far
call Build_DerefVisSpecDI
ORNF ds:[di].OLTDI_moreState, mask TDSS_GENERAL_CONSUMER_MODE
ret
TextGeneralConsumerMode endp
endif
TextNeverMakeScrollable proc far
call Build_DerefVisSpecDI
ORNF ds:[di].OLTDI_moreState, mask TDSS_STAY_OUT_OF_VIEW
ret
TextNeverMakeScrollable endp
TextAlpha proc far
class OLTextClass
call Build_DerefVisSpecDI
ANDNF ds:[di].VTI_filters, not mask VTF_FILTER_CLASS
ORNF ds:[di].VTI_filters, VTFC_ALPHA
ret
TextAlpha endp
TextUppercase proc far
class OLTextClass
call Build_DerefVisSpecDI
ORNF ds:[di].VTI_filters, mask VTF_UPCASE_CHARS
ret
TextUppercase endp
TextNumeric proc far
class OLTextClass
call Build_DerefVisSpecDI
and ds:[di].VTI_filters, not mask VTF_FILTER_CLASS
or ds:[di].VTI_filters, VTFC_NUMERIC
ret
TextNumeric endp
TextSignedNumeric proc far
class OLTextClass
call Build_DerefVisSpecDI
and ds:[di].VTI_filters, not mask VTF_FILTER_CLASS
or ds:[di].VTI_filters, VTFC_SIGNED_NUMERIC
ret
TextSignedNumeric endp
TextSignedDecimal proc far
class OLTextClass
call Build_DerefVisSpecDI
and ds:[di].VTI_filters, not mask VTF_FILTER_CLASS
or ds:[di].VTI_filters, VTFC_SIGNED_DECIMAL
ret
TextSignedDecimal endp
TextFloatDecimal proc far
class OLTextClass
call Build_DerefVisSpecDI
and ds:[di].VTI_filters, not mask VTF_FILTER_CLASS
or ds:[di].VTI_filters, VTFC_FLOAT_DECIMAL
ret
TextFloatDecimal endp
TextAlphaNumeric proc far
class OLTextClass
call Build_DerefVisSpecDI
and ds:[di].VTI_filters, not mask VTF_FILTER_CLASS
or ds:[di].VTI_filters, VTFC_ALPHA_NUMERIC
ret
TextAlphaNumeric endp
TextLegalFilenames proc far
class OLTextClass
call Build_DerefVisSpecDI
and ds:[di].VTI_filters, not mask VTF_FILTER_CLASS
or ds:[di].VTI_filters, VTFC_FILENAMES
ret
TextLegalFilenames endp
TextLegalDosFilenames proc far
class OLTextClass
call Build_DerefVisSpecDI
and ds:[di].VTI_filters, not mask VTF_FILTER_CLASS
or ds:[di].VTI_filters, VTFC_DOS_FILENAMES or mask VTF_NO_SPACES
ret
TextLegalDosFilenames endp
TextLegalDosVolumeNames proc far
class OLTextClass
call Build_DerefVisSpecDI
and ds:[di].VTI_filters, not mask VTF_FILTER_CLASS
or ds:[di].VTI_filters, VTFC_DOS_VOLUME_NAMES or mask VTF_NO_SPACES
ret
TextLegalDosVolumeNames endp
TextLegalDosPath proc far
class OLTextClass
call Build_DerefVisSpecDI
and ds:[di].VTI_filters, not mask VTF_FILTER_CLASS
or ds:[di].VTI_filters, VTFC_DOS_PATH or mask VTF_NO_SPACES
ret
TextLegalDosPath endp
TextDate proc far
class OLTextClass
call Build_DerefVisSpecDI
and ds:[di].VTI_filters, not mask VTF_FILTER_CLASS
or ds:[di].VTI_filters, VTFC_DATE
ret
TextDate endp
TextTime proc far
class OLTextClass
call Build_DerefVisSpecDI
and ds:[di].VTI_filters, not mask VTF_FILTER_CLASS
;
; VTF_NO_SPACES taken away, for cases like "8:00 AM"
; -- kho, 11/15/95
;
; or ds:[di].VTI_filters, VTFC_TIME or mask VTF_NO_SPACES
or ds:[di].VTI_filters, VTFC_TIME
ret
TextTime endp
TextDashedAlphaNumeric proc far
class OLTextClass
call Build_DerefVisSpecDI
and ds:[di].VTI_filters, not mask VTF_FILTER_CLASS
or ds:[di].VTI_filters, VTFC_DASHED_ALPHA_NUMERIC or \
mask VTF_NO_SPACES
ret
TextDashedAlphaNumeric endp
TextAllowColumnBreaks proc far
class OLTextClass
call Build_DerefVisSpecDI
and ds:[di].VTI_filters, not mask VTF_FILTER_CLASS
or ds:[di].VTI_filters, VTFC_ALLOW_COLUMN_BREAKS
ret
TextAllowColumnBreaks endp
TextNoSpaces proc far
class OLTextClass
call Build_DerefVisSpecDI
or ds:[di].VTI_filters, mask VTF_NO_SPACES
ret
TextNoSpaces endp
TextAllowSpaces proc far
class OLTextClass
call Build_DerefVisSpecDI
and ds:[di].VTI_filters, not mask VTF_NO_SPACES
ret
TextAllowSpaces endp
TextNormalAscii proc far
class OLTextClass
call Build_DerefVisSpecDI
and ds:[di].VTI_filters, not mask VTF_FILTER_CLASS
or ds:[di].VTI_filters, VTFC_NORMAL_ASCII
ret
TextNormalAscii endp
TextDosCharacterSet proc far
class OLTextClass
call Build_DerefVisSpecDI
and ds:[di].VTI_filters, not mask VTF_FILTER_CLASS
or ds:[di].VTI_filters, VTFC_DOS_CHARACTER_SET
ret
TextDosCharacterSet endp
TextWhiteWashColor proc far
mov di, ds:[si]
add di, ds:[di].Vis_offset
mov ds:[di].VTI_washColor.CQ_redOrIndex, C_WHITE
if DRAW_STYLES
;
; for draw styles, we use TDSS_COLOR_SET to know to look for a
; custom wash color
;
ornf ds:[di].OLTDI_specState, mask TDSS_COLOR_SET
endif
GOTO setFrame
TextWhiteWashColor endp
; ds:[bx] = ColorQuad to use
TextWashColor proc far
class OLTextClass
EC < push ax >
EC < VarDataSizePtr ds, bx, ax >
EC < cmp ax, size ColorQuad >
EC < ERROR_NE OL_BAD_HINT_DATA >
EC < pop ax >
call Build_DerefVisSpecDI
ornf ds:[di].OLTDI_specState, mask TDSS_COLOR_SET
push si
add di, offset VTI_washColor
push cx
lea si, ds:[bx]
segmov es, ds
mov cx, size ColorQuad
rep movsb
pop cx
pop si
setFrame label far
;
; Set some flags so draw the frame around text objects differently
; (or at all) to reflect the difference between the text object and
; its background.
;
call Build_DerefVisSpecDI
test ds:[di].OLTDI_specState, mask TDSS_IN_VIEW
jnz 10$
;
; We'll always frame editable text objects if this flag is on.
; For now, we won't frame non-editable text objects, nor leave a
; margin around them. The real reason we do this is for Ted's
; text object, which he makes white via this method but really is
; still the same color as the background.
;
test ds:[di].OLTDI_specState, mask TDSS_EDITABLE
jz 10$
ornf ds:[di].OLTDI_specState, mask TDSS_IN_FRAME
call SetTextMargins
10$:
ret
TextWashColor endp
TextRunsItemGroup proc far
call Build_DerefVisSpecDI
or ds:[di].OLTDI_moreState, mask TDSS_RUNS_ITEM_GROUP
mov ax, MSG_SPEC_TEXT_SET_FROM_ITEM_GROUP
call SetItemGroupDestAndStatusMsg
ret
TextRunsItemGroup endp
TextFrame proc far
call Build_DerefVisSpecDI
or ds:[di].OLTDI_specState, mask TDSS_IN_FRAME
call SetTextMargins
ret
TextFrame endp
COMMENT @----------------------------------------------------------------------
ROUTINE: SetItemGroupDestAndStatusMsg
SYNOPSIS: Sets up destination and status message of item group, so
it will be sent back to us.
CALLED BY: TextRunsItemGroup, RangeRunsItemGroup
PASS: *ds:si -- object
ds:bx -- hint instance data
ax -- status message to use
RETURN: nothing
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Chris 5/19/92 Initial version
------------------------------------------------------------------------------@
SetItemGroupDestAndStatusMsg proc far
hintParams local AddVarDataParams
hintData local word
.enter
push bp
push ax
mov cx, ds:[LMBH_handle]
mov dx, si
mov si, ds:[bx].chunk
mov bx, ds:[bx].handle ;setup to talk to object
mov ax, MSG_GEN_ITEM_GROUP_SET_DESTINATION
call ObjMsgCall
;
; Set up a status message attribute in the list so it will talk to
; us on user changes.
;
pop ax ;restore status msg to use
mov hintParams.AVDP_dataType, ATTR_GEN_ITEM_GROUP_STATUS_MSG
mov hintParams.AVDP_dataSize, 2
lea cx, hintData
mov hintParams.AVDP_data.offset, cx
mov hintParams.AVDP_data.segment, ss
mov hintData, ax
lea bp, hintParams
mov ax, MSG_META_ADD_VAR_DATA
call ObjMsgCall
pop bp
.leave
ret
SetItemGroupDestAndStatusMsg endp
ObjMsgCall proc near
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage
ret
ObjMsgCall endp
COMMENT @----------------------------------------------------------------------
ROUTINE: SetupDelayedMode
SYNOPSIS: Sets up delayed mode status for the object.
CALLED BY: OLTextSpecBuild
PASS: *ds:si -- text
RETURN: nothing
DESTROYED: ax, cx, dx, bp, di, es
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Chris 11/14/92 Initial version
------------------------------------------------------------------------------@
SetupDelayedMode proc near
;Check for OLBF_DELAYED set in parent. Set ourselves if so.
; if in a View, ask the view for the build flags
call Build_DerefVisSpecDI
test ds:[di].OLTDI_specState, mask TDSS_IN_VIEW
jz notInView
push si
mov si, ds:[di].OLTDI_viewObj ;view chunk handle kept here
mov ax, MSG_VUP_GET_BUILD_FLAGS
call ObjCallInstanceNoLock
pop si
jmp short haveBuildFlag
notInView:
call OpenGetParentBuildFlagsIfCtrl
haveBuildFlag:
test cx, mask OLBF_DELAYED_MODE
jz exit
call Build_DerefVisSpecDI
or ds:[di].OLTDI_moreState, mask TDSS_DELAYED
exit:
segmov es, cs ; setup es:di to be ptr to
mov di, offset cs:DelayedVarDataHandler
mov ax, length (cs:DelayedVarDataHandler)
call ObjVarScanData ;
ret
SetupDelayedMode endp
DelayedVarDataHandler VarDataHandler \
<ATTR_GEN_PROPERTY, offset TextProperty>,
<ATTR_GEN_NOT_PROPERTY, offset TextNotProperty>
TextProperty proc far
call Build_DerefVisSpecDI
or ds:[di].OLTDI_moreState, mask TDSS_DELAYED
ret
TextProperty endp
TextNotProperty proc far
call Build_DerefVisSpecDI
and ds:[di].OLTDI_moreState, not mask TDSS_DELAYED
ret
TextNotProperty endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
TextAutoHyphenate
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Allow auto hyphenation in the text object.
CALLED BY: Via ObjVarScanData
PASS: ds:*si = instance ptr.
RETURN: nothing
DESTROYED: di
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jcw 1/ 2/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
TextAutoHyphenate proc far
class OLTextClass
call Build_DerefVisSpecDI
ornf ds:[di].VTI_features, mask VTF_AUTO_HYPHENATE
ret ;
TextAutoHyphenate endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
TextSelectText
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Select the text...
CALLED BY: ObjVarScanData
PASS: ds:*si = instance ptr.
RETURN: nothing
DESTROYED: ax, di
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jcw 1/ 2/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
TextSelectText proc far
uses cx, dx, bp
.enter
sub sp, size VisTextRange ; Allocate stack frane
mov bp, sp ; ss:bp <- frame ptr
clrdw ss:[bp].VTR_start
movdw ss:[bp].VTR_end, TEXT_ADDRESS_PAST_END
mov ax, MSG_VIS_TEXT_SELECT_RANGE
call ObjCallInstanceNoLock ; Select the range
add sp, size VisTextRange ; Restore stack frame
.leave
ret
TextSelectText endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
TextCursorAtStart
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Position the cursor at the start of the text.
CALLED BY: ObjVarScanData
PASS: ds:*si = instance ptr.
RETURN: nothing
DESTROYED: di
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jcw 1/ 2/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
TextCursorAtStart proc far
uses ax, cx, dx, bp
.enter
sub sp, size VisTextRange ; Allocate stack frane
mov bp, sp ; ss:bp <- frame ptr
clrdw ss:[bp].VTR_start
clrdw ss:[bp].VTR_end
mov ax, MSG_VIS_TEXT_SELECT_RANGE
call ObjCallInstanceNoLock ; Select the range
add sp, size VisTextRange ; Restore stack frame
.leave
ret
TextCursorAtStart endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
TextCursorAtEnd
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Position the cursor at the end of the text.
CALLED BY: ObjVarScanData
PASS: ds:*si = instance ptr.
RETURN: nothing
DESTROYED: ax, di
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jcw 1/ 2/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
TextCursorAtEnd proc far
uses cx, dx, bp
.enter
sub sp, size VisTextRange ; Allocate stack frane
mov bp, sp ; ss:bp <- frame ptr
movdw ss:[bp].VTR_start, TEXT_ADDRESS_PAST_END
movdw ss:[bp].VTR_end, TEXT_ADDRESS_PAST_END
mov ax, MSG_VIS_TEXT_SELECT_RANGE
call ObjCallInstanceNoLock ; Select the range
add sp, size VisTextRange ; Restore stack frame
.leave
ret
TextCursorAtEnd endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
TextAllowSmartQuotes
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Allow smart quotes in this object
CALLED BY: GLOBAL
PASS: ds:*si = instance ptr
RETURN: nada
DESTROYED: di
PSEUDO CODE/STRATEGY:
This page intentionally left blank
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
atw 6/17/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
TextAllowSmartQuotes proc far
call Build_DerefVisSpecDI
ornf ds:[di].VTI_features, mask VTF_ALLOW_SMART_QUOTES
ret
TextAllowSmartQuotes endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
TextAllowUndo
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Allow smart quotes in this object
CALLED BY: GLOBAL
PASS: ds:*si = instance ptr
RETURN: nada
DESTROYED: di
PSEUDO CODE/STRATEGY:
This page intentionally left blank
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
atw 6/17/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
TextAllowUndo proc far
call Build_DerefVisSpecDI
ornf ds:[di].VTI_features, mask VTF_ALLOW_UNDO
ret
TextAllowUndo endp
COMMENT @----------------------------------------------------------------------
ROUTINE: TextDoNotUseMoniker
SYNOPSIS: Handles DO_NOT_USE_MONIKER hint for OLTextClass.
CALLED BY: hint handler
PASS: *ds:si -- object
RETURN: nothing
DESTROYED: di
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Chris 11/ 2/89 Initial version
------------------------------------------------------------------------------@
TextDoNotUseMoniker proc far
class OLTextClass
call Build_DerefVisSpecDI
or ds:[di].OLTDI_specState, mask TDSS_NO_MONIKER
ret
TextDoNotUseMoniker endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SetDefaultBGColor
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Set the default background color based on the position
of the text object.
CALLED BY: OLTextSpecBuild, CreateView
PASS: ds:*si = instance ptr.
RETURN: background color set appropriately.
DESTROYED: ax, bx, cx, dx, di, bp
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jcw 7/13/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SetDefaultBGColor proc near
class OLTextClass
call Build_DerefVisSpecDI
mov bx, di
test ds:[di].OLTDI_specState, mask TDSS_COLOR_SET
jnz done
; set wash color
mov al, C_WHITE ; default to white.
if _OL_STYLE or _MOTIF or _ISUI
;
; If we're not color specific (in motif and openlook), we will set the
; text background color to the window color.
;
push ds
mov ax, segment moCS_dsLightColor
mov ds, ax
mov al, ds:[moCS_dsLightColor]
pop ds
SDBGC_setColor: ;
endif
mov cl, al ; Red (or color) component.
mov ch, CF_INDEX
clr dx ; Green and blue
mov ax, MSG_VIS_TEXT_SET_WASH_COLOR ;
call ObjCallInstanceNoLock ;
done:
ret ;
SetDefaultBGColor endp
COMMENT @----------------------------------------------------------------------
METHOD: OLTextScanGeometryHints --
MSG_SPEC_SCAN_GEOMETRY_HINTS for OLTextClass
DESCRIPTION: Scans geometry hints.
PASS: *ds:si - instance data
es - segment of MetaClass
ax - MSG_SPEC_SCAN_GEOMETRY_HINTS
RETURN: nothing
ax, cx, dx, bp - destroyed
ALLOWED TO DESTROY:
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
chris 2/ 5/92 Initial Version
------------------------------------------------------------------------------@
OLTextScanGeometryHints method static OLTextClass, \
MSG_SPEC_SCAN_GEOMETRY_HINTS
uses bx, di, es ; To comply w/static call requirements
.enter ; that bx, si, di, & es are preserved.
; NOTE that es is NOT segment of class
; mov di, segment OLTextClass
; mov es, di
mov di, ds:[si] ;must dereference for static
add di, ds:[di].Vis_offset ; method!
ANDNF ds:[di].OLTDI_moreState, not \
(mask TDSS_EXPAND_WIDTH_TO_FIT_PARENT or \
mask TDSS_EXPAND_HEIGHT_TO_FIT_PARENT)
;
; In multi-line text objects, editable or not editable, we'll want to
; always expand the width to fit the available space.
;
test ds:[di].VTI_state, mask VTS_ONE_LINE
jnz scanHints
or ds:[di].OLTDI_moreState, mask TDSS_EXPAND_WIDTH_TO_FIT_PARENT
scanHints:
segmov es, cs ; setup es:di to be ptr to
; Hint handler table
mov di, offset cs:GeoVarDataHandler
mov ax, length (cs:GeoVarDataHandler)
call ObjVarScanData ;
;
; New text optimization code goes here.
;
call Build_DerefVisSpecDI
test ds:[di].OLTDI_moreState, mask TDSS_EXPAND_WIDTH_TO_FIT_PARENT \
or mask TDSS_EXPAND_HEIGHT_TO_FIT_PARENT
jnz exit ;expanding forget optimization
mov ax, HINT_FIXED_SIZE
call ObjVarFindData
jnc exit ;did not find hint, no opts
call Build_DerefVisSpecDI
or ds:[di].VI_geoAttrs, mask VGA_ONLY_RECALC_SIZE_WHEN_INVALID
exit:
.leave
ret
OLTextScanGeometryHints endm
GeoVarDataHandler VarDataHandler \
<HINT_EXPAND_WIDTH_TO_FIT_PARENT, offset TextExpandWidth>,
<HINT_EXPAND_HEIGHT_TO_FIT_PARENT, offset TextExpandHeight>
TextExpandWidth proc far
call Build_DerefVisSpecDI
ORNF ds:[di].OLTDI_moreState, mask TDSS_EXPAND_WIDTH_TO_FIT_PARENT
ret
TextExpandWidth endp
TextExpandHeight proc far
call Build_DerefVisSpecDI
ORNF ds:[di].OLTDI_moreState, mask TDSS_EXPAND_HEIGHT_TO_FIT_PARENT
ret
TextExpandHeight endp
COMMENT @----------------------------------------------------------------------
ROUTINE: RemoveComposite
SYNOPSIS: Removes composite from the picture before building a view.
CALLED BY: OLTextSpecBuild
PASS: *ds:si -- handle of text object
RETURN: bl -- old composite's margin flags (OLCtrlMarginFlags)
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Chris 11/ 3/89 Initial version
------------------------------------------------------------------------------@
RemoveComposite proc near
class OLTextClass
clr bl ;assume no composite, we'll
; start with no margin flags
call Build_DerefVisSpecDI
test ds:[di].OLTDI_specState, mask TDSS_IN_COMPOSITE
jz exit ;not in a composite, branch
push bp ;preserve bp
push si
;
; Remove composite from its parent, destroy it, but not before getting
; the composite's margin flags to pass on to the view.
;
mov si, ds:[di].OLTDI_viewObj ;composite handle kept here
; mov bl, ds:[di].OLCI_marginFlags ;get composite's margin flags
mov dl, VUM_MANUAL ; The parent will be updated
; later, when the view is
; added.
call VisRemove ; Close, remove & destroy
; the composite.
pop si
pop bp
exit:
ret
RemoveComposite endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLTextVisUnbuild
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Make sure text object releases focus & exclusive
grabs, since text object is being visually unbuilt.
Then do see if we need to set an associated view or
composite as well.
CALLED BY: via MSG_SPEC_UNBUILD_BRANCH
PASS: ds:*si = instance ptr.
es = class segment.
ax = MSG_SPEC_UNBUILD
bp - SpecBuildFlags
SBF_VIS_PARENT_UNBUILDING - set if
we're being called only because visible parent,
not generic, is unbuilding.
RETURN: nothing
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 10/89 Initial version
jcw 10/13/89 2d Initial version
Doug 1/90 Converted from SPEC_SET_NOT_USABLE handler
IP 8/94 Free VTI_lines on UNBUILD
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLTextVisUnbuild method dynamic OLTextClass, MSG_SPEC_UNBUILD
EC < call ECCheckGenTextObject >
EC < call VisCheckIfVisGrown >
EC < ERROR_NC OL_TEXT_DISPLAY_VIS_UNBUILD_PASSED_NON_BUILT_OBJECT >
clr di ;assume no visual parent
mov ax, di
;
; Free VTI_lines since when the vis text object gets
; regenerated, it will allocate a new chunk for VTI_lines.
;
mov bx, ds:[si] ;point to instance
add bx, ds:[bx].Vis_offset ;ds:[bx] -- SpecInstance
xchg ax, ds:[bx].VTI_lines
tst ax
jz noLines
andnf ds:[bx].VTI_intFlags, not (mask VTIF_HAS_LINES)
call LMemFree
noLines:
;
; The text object may have created a char attr run - if so, free it.
;
mov bx, ds:[si]
add bx, ds:[bx].VisText_offset
; If we just have a default char attr, nothing to free
; If we have multiple char attrs, then they are set up by the user,
; and we should not free them.
test ds:[bx].VTI_storageFlags, mask VTSF_DEFAULT_CHAR_ATTR or mask VTSF_MULTIPLE_CHAR_ATTRS
jnz afterCharAttrFree
; Free our single char attr, and tell the text object it now
; just has a "default char attr".
ornf ds:[bx].VTI_storageFlags, mask VTSF_DEFAULT_CHAR_ATTR
mov cx, VIS_TEXT_INITIAL_CHAR_ATTR
xchg ds:[bx].VTI_charAttrRuns, cx
mov ax, ATTR_GEN_TEXT_CHAR_ATTR
call ObjVarFindData
jnc freeIt
cmp cx, ds:[bx]
je afterCharAttrFree
freeIt:
mov_tr ax, cx ;AX <- chunk to free
call LMemFree
jmp afterCharAttrFree
afterCharAttrFree:
mov ax, di ;assume parent is not a view
mov bx, ds:[si] ;point to instance
add bx, ds:[bx].Vis_offset ;ds:[bx] -- SpecInstance
test ds:[bx].OLTDI_specState, mask TDSS_IN_VIEW or \
mask TDSS_IN_COMPOSITE
jz 10$ ;not in view or composite...
mov di, ds:[bx].OLTDI_viewObj ;else *ds:si <- parent
test ds:[bx].OLTDI_specState, mask TDSS_IN_VIEW
jz 10$ ;not a view, branch
dec ax ;mark parent as a view
10$:
mov bl, al ;pass view flag in bl
mov ax, -1 ;yes! destroy moniker here
call OpenUnbuildCreatedParent ; unbuild parent, then remove
; ourselves
mov di, ds:[si]
add di, ds:[di].Vis_offset
and ds:[di].OLTDI_specState, not (mask TDSS_IN_VIEW or \
mask TDSS_IN_COMPOSITE)
clr ds:[di].OLTDI_viewObj
;
; Update generic instance data.
; Not sure we're going to do this. -cbh 9/ 2/92
;
; mov ax, MSG_VIS_TEXT_UPDATE_GENERIC
; call ObjCallInstanceNoLock
ret
OLTextVisUnbuild endm
Build ends
Unbuild segment resource
COMMENT @----------------------------------------------------------------------
METHOD: OLTextSetNotUsable --
MSG_SPEC_SET_NOT_USABLE for OLTextClass
DESCRIPTION: Handles being set not usable.
PASS: *ds:si - instance data
es - segment of MetaClass
ax - MSG_SPEC_SET_NOT_USABLE
RETURN: nothing
ax, cx, dx, bp - destroyed
ALLOWED TO DESTROY:
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
chris 10/26/92 Initial Version
------------------------------------------------------------------------------@
OLTextSetNotUsable method dynamic OLTextClass, \
MSG_SPEC_SET_NOT_USABLE
call OLTextNavigateIfHaveFocus ;get rid of focus if we have it
mov di, offset OLTextClass
CallSuper MSG_SPEC_SET_NOT_USABLE
ret
OLTextSetNotUsable endm
Unbuild ends
Build segment resource
COMMENT @----------------------------------------------------------------------
ROUTINE: CreateView
DESCRIPTION: If not already created, create a generic view & content
object for text to appear in. Initialize them.
PASS:
*ds:si - instance data
bp - SpecBuildFlags
; bl - Margin flags to start with (OLCtrlMarginFlags)
RETURN:
bp - unchanged
DESTROYED:
ax, bx, cx, dx, di
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
If not yet IN_VIEW {
Create GenView, GenContent objects;
Add view generically after the text object;
Initialize objects;
Mark as IN_VIEW
}
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 9/89 Snagged from old PlaceInView routine
atw 12/91 Changed to use ESP-style local vars, and
to set GenViewInkType instance data.
------------------------------------------------------------------------------@
CreateView proc near uses si
class OLTextClass
EC < call ECCheckGenTextObject >
;
view local lptr ; created object
ourObj local lptr ; our object
content local lptr ; content, if needed
mov ax, bp ; ax <- build flags
.enter
mov di, ds:[si] ;
add di, ds:[di].Vis_offset ;
test ds:[di].OLTDI_specState, mask TDSS_IN_VIEW
LONG jnz exit ; just quit if already in view
push ax
mov ourObj, si ; STORE handle of text object
; in local var
call VisGetSize ; increase width to account for
if DRAW_STYLES ;--------------------------------------------------------------
;
; we actually have to reduce the size of the text object as we'll
; later (SetMinMaxHints) fetch its size and set a fixed size hint
; on the view. The view will take this size and add room for the
; frame and insets. -- brianc 9/19/96
;
mov ax, cx ; save current width
mov bx, dx ; save current height
test ds:[di].OLTDI_specState, mask TDSS_IN_FRAME
jz noFrame
sub cx, FRAME_TEXT_MARGIN*2
sub dx, FRAME_TEXT_MARGIN*2
noFrame:
if TEXT_DISPLAY_FOCUSABLE and 0
test ds:[di].OLTDI_moreState, mask TDSS_FOCUSABLE
jz notFocusable
cmp cx, ax
jne haveFLRGutter
sub cx, 1+1 ; add left/right gutters
haveFLRGutter:
sub cx, TEXT_DISPLAY_FOCUS_WIDTH*2 ; add focus l/r width
cmp dx, bx
jne haveFTBGutter
sub dx, 1+1 ; add top/bottom gutters
haveFTBGutter:
sub dx, TEXT_DISPLAY_FOCUS_WIDTH*2 ; add focus t/b width
notFocusable:
endif
mov di, ds:[di].OLTDI_moreState
andnf di, mask TDSS_DRAW_STYLE
cmp di, DS_LOWERED shl offset TDSS_DRAW_STYLE
je addInset
cmp di, DS_RAISED shl offset TDSS_DRAW_STYLE
jne noInset
addInset:
cmp cx, ax
jne haveDSLRGutter
sub cx, 1+1 ; add left/right gutters
haveDSLRGutter:
add cx, DRAW_STYLE_INSET_WIDTH*2 ; add inset l/r width
cmp dx, bx
jne haveDSTBGutter
sub dx, 1+1 ; add top/bottom gutters
haveDSTBGutter:
sub dx, DRAW_STYLE_INSET_WIDTH*2 ; add inset t/b height
noInset:
;
; Prevent negative width/height
;
tst cx
jns checkHeight
clr cx
checkHeight:
tst dx
jns heightOk
clr dx
heightOk:
else ;-------------------------------------------------------------------------
add cx, FRAME_TEXT_MARGIN*2 ; new frame margin so view
if TEXT_DISPLAY_FOCUSABLE
test ds:[di].OLTDI_moreState, mask TDSS_FOCUSABLE
jz notFocusable
add cx, TEXT_DISPLAY_FOCUS_WIDTH*2
notFocusable:
endif
endif ; DRAW_STYLES -----------------------------------------------------------
call VisSetSize ; will reflect it when created
mov di, segment GenViewClass
mov es, di
mov di, offset GenViewClass
call OpenCreateNewParentObject
mov view, di ; save view handle
;
; Copy ATTR_GEN_PROPERTY, ATTR_GEN_NOT_PROPERTY hints to view
; *ds:si = text; *ds:di = view
;
push es, bp ; save segment, locals
segmov es, ds ; *es:bp = view
mov bp, di
.assert (ATTR_GEN_PROPERTY eq ATTR_GEN_NOT_PROPERTY-4)
mov cx, ATTR_GEN_PROPERTY
mov dx, ATTR_GEN_NOT_PROPERTY
call ObjVarCopyDataRange
pop es, bp ; restore segment, locals
;
; Transfer text colors to view. Also, if text is disabled, so should
; the view be. *ds:si = text; *ds:di = view
;
; Pass current text colors
;
mov bx, ds:[si]
add bx, ds:[bx].Vis_offset
movdw dxcx, ds:[bx].VTI_washColor
if DRAW_STYLES
;
; transfer frame state and draw style
;
push ds:[bx].OLTDI_moreState
test ds:[bx].OLTDI_specState, mask TDSS_IN_FRAME
pushf
endif
and ch, mask WCF_RGB
mov bx, ds:[di]
add bx, ds:[bx].Gen_offset
movdw ds:[bx].GVI_color, dxcx
if DRAW_STYLES
;
; set frame state
;
popf
jnz leaveFrame
ornf ds:[bx].GVI_attrs, mask GVA_NO_WIN_FRAME
leaveFrame:
;
; set draw style (default for view is flat)
;
pop cx ; OLTDI_moreState
andnf cx, mask TDSS_DRAW_STYLE
mov ax, HINT_DRAW_STYLE_3D_RAISED
cmp cx, DS_RAISED shl offset TDSS_DRAW_STYLE
je haveDrawStyle
cmp cx, DS_LOWERED shl offset TDSS_DRAW_STYLE
jne doneDrawStyle
mov ax, HINT_DRAW_STYLE_3D_LOWERED
haveDrawStyle:
push si
mov si, di ; *ds:si = view
clr cx ; no extra data
call ObjVarAddData
pop si
doneDrawStyle:
endif ; DRAW_STYLES
mov cx, di
mov di, ds:[si] ;
add di, ds:[di].Vis_offset ;
mov ds:[di].OLTDI_viewObj, cx ; Store view handle
; Mark this object as in view
ornf ds:[di].OLTDI_specState, mask TDSS_IN_VIEW
; No longer in frame.
andnf ds:[di].OLTDI_specState, not (mask TDSS_IN_FRAME or \
mask TDSS_GOING_INTO_VIEW)
;
if DRAW_STYLES
;
; no longer 3D draw style
;
andnf ds:[di].OLTDI_moreState, not (mask TDSS_DRAW_STYLE)
if (DS_FLAT ne 0)
ornf ds:[bx].OLTDI_moreState, DS_FLAT shl offset TDSS_DRAW_STYLE
endif
endif
;
; Set the margins of the text object. Top/bottom margins don't really
; make sense any more, and left/right margins only need to be one pixel
; to prevent the text from touching the edges of the screen, since the
; frame is not part of the text object.
;
if DRAW_STYLES
;
; no need for margins here, as the view provides a nice gutter
;
mov ds:[di].VTI_lrMargin, 1
else
mov ds:[di].VTI_lrMargin, FRAME_TEXT_MARGIN
endif
clr ds:[di].VTI_tbMargin
mov al, GVIT_QUERY_OUTPUT
test ds:[di].OLTDI_specState, mask TDSS_EDITABLE
jne isEditable
; If this is not an editable object, make the view focusable only
; if the object is selectable, and not targetable on noKeyboard
; systems. It has to be able to get the focus on other systems,
; so the user can use PageUp/PageDown to scroll it.
;
; WRONG! Even systems without keyboards may have buttons to scroll
; the view (like Zoomer). So, we still allow the view to get the
; focus, but we add ATTR_GEN_VIEW_DOES_NOT_ACCEPT_TEXT_INPUT so the
; view won't force the floating kbd onscreen 4/29/93 -atw.
call CheckIfKeyboardRequired
jnc noInk
mov si, view
mov ax, ATTR_GEN_VIEW_DOES_NOT_ACCEPT_TEXT_INPUT or mask VDF_SAVE_TO_STATE
call ObjVarAddData
mov si, ourObj
mov di, ds:[si]
add di, ds:[di].Vis_offset
noInk:
mov al, GVIT_PRESSES_ARE_NOT_INK
isEditable:
mov bx, view
mov bx, ds:[bx]
add bx, ds:[bx].Gen_offset
mov ds:[bx].GVI_inkType, al
mov al, mask GVDA_SCROLLABLE
if _GCM
;
; Disallow scrollbar in GCM.
;
test ds:[di].OLTDI_moreState, mask TDSS_GENERAL_CONSUMER_MODE
jz TDCV_checkViewMax
andnf al, not mask GVDA_SCROLLABLE ; no scrollbar in GCM
TDCV_checkViewMax:
endif ; _GCM
mov di, ourObj ; get desired width of text
mov di, ds:[di]
add di, ds:[di].Gen_offset
test ds:[di].GTXI_attrs, mask GTA_TAIL_ORIENTED
jnz setTailOriented ; tail oriented, set flag
test ds:[di].GTXI_attrs, mask GTA_DONT_SCROLL_TO_CHANGES
jnz setVertAttrs ; not scrolling to changes,
; branch
setTailOriented:
ornf al, mask GVDA_TAIL_ORIENTED ; else tail oriented
setVertAttrs:
mov ds:[bx].GVI_vertAttrs, al ; store view attributes
ORNF ds:[bx].GVI_attrs, mask GVA_TRACK_SCROLLING or \
mask GVA_DRAG_SCROLLING or \
mask GVA_DONT_SEND_KBD_RELEASES or \
mask GVA_GENERIC_CONTENTS
call SetMinMaxSizeHints ; if needed
if DRAW_STYLES
;
; tell view that it is for a text object
;
mov si, view ; *ds:si = view
mov ax, ATTR_OL_PANE_SCROLLING_TEXT
mov cx, size lptr
call ObjVarAddData
mov ax, ourObj
mov ds:[bx], ax
endif
;
; Set the line height as the scroll increment.
;
mov si, ourObj
call GetTextObjectLineHeight
mov_tr ax, bx
mov cx, ax ; ax, cx <- line height.
mov di, view
mov bx, ds:[di]
add bx, ds:[bx].Gen_offset
mov ds:[bx].GVI_increment.PD_y.low, ax
pop ax ; restore build flags
mov bl, 0ffh ; set view flag
call OpenBuildNewParentObject ; *ds:ax <- newly created obj
;
; See if we need to restore the gadget exclusive, which we may have
; had to release in order to pop ourselves into a view.
;
mov di, ds:[si] ; point to instance
add di, ds:[di].Vis_offset ; ds:[di] -- SpecInstance
test ds:[di].OLTDI_specState, mask TDSS_NEEDS_GADGET_EXCL
jz doFocusTarget ; don't need it, done
; (carry clear)
and ds:[di].OLTDI_specState, not (mask TDSS_NEEDS_GADGET_EXCL)
push bp
mov cx, ds:[LMBH_handle] ; ^lcx:dx = object to grab for
mov dx, si
mov ax, MSG_VIS_TAKE_GADGET_EXCL
call VisCallParent
pop bp
stc ; grab for view also
doFocusTarget:
;
; grab focus and target for text object within content
; carry set to also grab for view within its parent
; carry clear otherwise
;
pushf
call MetaGrabFocusExclLow ; now for the text object
call MetaGrabTargetExclLow
popf
jnc exit ; no need to grab for view
push si ; grab the focus for the view
mov si, view ;
call MetaGrabFocusExclLow
call MetaGrabTargetExclLow
pop si
exit:
.leave
ret ;
CreateView endp
COMMENT @----------------------------------------------------------------------
ROUTINE: SetMinMaxSizeHints
SYNOPSIS: Sets minimum and maximum size hints on the view, if needed.
CALLED BY: CreateView
PASS: *ds:si -- text
RETURN: nothing
DESTROYED: something
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Chris 9/17/92 Initial version
------------------------------------------------------------------------------@
SetMinMaxSizeHints proc near
view local lptr ; created object
ourObj local lptr ; our object
content local lptr ; content, if needed
.enter inherit
;
; Stick appropriate minimum and maximum sizes on the view. The
; maximum size is that text's current size (only if expand-to-fit
; is clear in that direction); the minimum width is
; the one returned by the text object. -cbh 9/ 2/92
;
mov si, ourObj ; *ds:si <- text
clr cx
mov dx, cx
call VisCheckIfVisGrown ; see if grown...
jnc 0$ ; no, start with no size
mov di, ds:[si]
add di, ds:[di].Vis_offset
test ds:[di].VI_geoAttrs, mask VGA_GEOMETRY_CALCULATED
jz 0$ ; geo never been done, branch
call VisGetSize ; get current size
0$:
;
; If the size isn't determined yet (initScrolling attribute on?), then
; we'll use a standard size, if there isn't anything else.
;
tst cx
jnz 1$
mov cx, SpecWidth <SST_PIXELS, DEFAULT_TEXT_WIDTH>
1$:
tst dx
jnz 2$
mov dx, SpecHeight <SST_LINES_OF_TEXT, DEFAULT_TEXT_HEIGHT>
2$:
;
; If the text is expanding to fit in one direction or the other,
; forget this maximum size stuff in that direction.
;
mov di, ds:[si]
add di, ds:[di].Vis_offset
test ds:[di].OLTDI_moreState, mask TDSS_EXPAND_WIDTH_TO_FIT_PARENT
jz 10$
clr cx
10$:
test ds:[di].OLTDI_moreState, mask TDSS_EXPAND_HEIGHT_TO_FIT_PARENT
jz 20$
clr dx
20$:
mov ax, HINT_FIXED_SIZE ;a preset fixed size, forget
call ObjVarFindData ; this min/max size stuff
jc exit ; (cbh 2/ 6/93)
;
; If we haven't done geometry yet, and there's an initial size
; specified, forget about putting a max size on the view. -cbh 2/18/93
;
mov di, ds:[si]
add di, ds:[di].Vis_offset
test ds:[di].VI_geoAttrs, mask VGA_GEOMETRY_CALCULATED
jnz doMax
mov ax, HINT_INITIAL_SIZE
call ObjVarFindData
jc doMin
doMax:
mov si, view ;add a maximum size
mov ax, HINT_MAXIMUM_SIZE
call AddArgsToSizeHint
doMin:
;
; Do minimum size as well, as long as nothing's there.
;
mov cx, DEFAULT_TEXT_MIN_WIDTH
mov dx, SpecHeight <SST_LINES_OF_TEXT, 1>
mov ax, HINT_MINIMUM_SIZE
call AddArgsToSizeHint
exit:
.leave
ret
SetMinMaxSizeHints endp
COMMENT @----------------------------------------------------------------------
ROUTINE: AddArgsToSizeHint
SYNOPSIS: Adds arguments to size hint, if needed. Any non-zero width
or height will be added as a size argument if there isn't
something already specified in a hint.
CALLED BY: SetMinMaxSizeHints
PASS: *ds:si -- view
ax -- size hint to apply arguments to
cx -- width to set (zero if none)
dx -- height to set (zero if none)
RETURN: nothing
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Chris 10/26/92 Initial version
------------------------------------------------------------------------------@
AddArgsToSizeHint proc near
;
; If a hint is already specified, we have to do the right thing (i.e.
; not obliterate any arguments that are already there).
;
tst cx ;nothing to add, exit
jnz doSize
tst dx
jz exit
doSize:
call ObjVarFindData
jc setSizeArgs ;exists, don't create
push cx
mov cx, size GadgetSizeHintArgs
call ObjVarAddData
pop cx
clr ds:[bx].GSHA_width
clr ds:[bx].GSHA_height
setSizeArgs:
tst ds:[bx].GSHA_width ;already specified, branch
jnz 30$
tst cx ;nothing to set, leave alone
jz 30$
mov ds:[bx].GSHA_width, cx
30$:
tst ds:[bx].GSHA_height
jnz exit
tst dx
jz exit
mov ds:[bx].GSHA_height, dx
exit:
ret
AddArgsToSizeHint endp
COMMENT @----------------------------------------------------------------------
ROUTINE: CreateComposite
DESCRIPTION: If not already created, create a generic interaction for text
to appear in. Initialize it.
PASS:
*ds:si - instance data
bp - SpecBuildFlags
RETURN:
bp - unchanged
DESTROYED:
ax, bx, cx, dx, di
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
If not yet IN_VIEW {
Create GenInteraction object
Give GenInteraction an upward only link;
Initialize objects;
Mark as IN_COMPOSITE
}
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Chris 11/89 Initial version
------------------------------------------------------------------------------@
;
; Put addresses of classes here, so we can reference them (imported from UI
; library)
;
OLTDCC_StackFrame struct
OLTDCC_comp lptr
OLTDCC_text lptr
OLTDCC_StackFrame ends
OLTDCC_Local equ <[bp - (size OLTDCC_StackFrame)]>
compHandle equ <OLTDCC_Local.OLTDCC_comp>
textHandle equ <OLTDCC_Local.OLTDCC_text>
CreateComposite proc near
class OLTextClass
mov ax, bp ; ax <- build flags
mov bp, sp ;
sub sp, size OLTDCC_StackFrame ;
push si ;
;
mov di, ds:[si] ;
add di, ds:[di].Vis_offset ;
test ds:[di].OLTDI_specState, mask TDSS_IN_COMPOSITE
jz TDCC_DoIt ;
jmp Done ; just quit if already in comp
;
TDCC_DoIt: ;
mov textHandle, si ; STORE handle of text object
; in local var
mov di, segment GenInteractionClass
mov es,di
mov di, offset GenInteractionClass
call OpenCreateNewParentObject
mov compHandle, di
clr bx ; no view flag
call OpenBuildNewParentObject ; create comp, place us under it
; returned in ax
;
; Set the enabled bit in the composite to match that of the text.
;
mov si, ax
mov bx, ds:[si] ;point to composite instance
add bx, ds:[bx].Gen_offset ;ds:[di] -- GenInstance
and ds:[bx].GI_states, not mask GS_ENABLED
mov si, textHandle ;get handle of text
mov di, ds:[si] ;point to instance
add di, ds:[di].Gen_offset ;ds:[di] -- GenInstance
test ds:[di].GI_states, mask GS_ENABLED
jz 10$ ; text not enabled, branch
or ds:[bx].GI_states, mask GS_ENABLED
10$:
;
; Don't turn into a button!
;
mov ds:[bx].GII_type, GIT_ORGANIZATIONAL
mov ds:[bx].GII_visibility, GIV_SUB_GROUP
;------------------------------------------------------------------------------
; Set flag in text object (textHandle in si)
;------------------------------------------------------------------------------
;
mov di, ds:[si] ;
add di, ds:[di].Vis_offset ;
or ds:[di].OLTDI_specState, mask TDSS_IN_COMPOSITE
mov si, compHandle ; save handle of composite
mov ds:[di].OLTDI_viewObj, si ; keep in this variable
;
; Ignore desired size hints in OLCtrl. Also, let's ensure the OLCtrl
; expands width to fit if the text object is doing so. (Also, bottom
; justify children, which should fix most font size problems, at
; least in single line text. -cbh 11/30/92)
;
test ds:[di].OLTDI_moreState, mask TDSS_EXPAND_WIDTH_TO_FIT_PARENT
pushf
mov di, ds:[si] ; tell OLCtrl to ignore these
add di, ds:[di].Vis_offset ; (handled in text object)
popf
jz 20$
or ds:[di].VCI_geoDimensionAttrs, \
mask VCGDA_EXPAND_WIDTH_TO_FIT_PARENT or \
(HJ_BOTTOM_JUSTIFY_CHILDREN shl \
offset VCGDA_HEIGHT_JUSTIFICATION)
20$:
or ds:[di].OLCI_optFlags, mask OLCOF_IGNORE_DESIRED_SIZE_HINTS
;
; since text object handles kbd mnemonic, and since we copied our
; moniker and mnemonic to the OLCtrl, don't handle mnemonic on the
; OLCtrl.
;
ornf ds:[di].OLCI_moreFlags, mask OLCOF_IGNORE_MNEMONIC
Done:
pop si ;
mov sp, bp ;
ret ;
CreateComposite endp
COMMENT @----------------------------------------------------------------------
METHOD: OLTextGetSpecVisObj --
MSG_SPEC_GET_SPECIFIC_VIS_OBJECT for OLTextClass
DESCRIPTION: Returns specific object used for this generic object.
PASS: *ds:si - instance data
es - segment of MetaClass
ax - MSG_SPEC_GET_SPECIFIC_VIS_OBJECT
bp - SpecBuildFlags
RETURN: cx:dx - the specific object (or null if caller is querying
for the win group part)
carry set
DESTROYED: bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Chris 10/25/89 Initial version (did I write this code? I
didn't write this. I didn't
know what it did until I
asked Doug.)
------------------------------------------------------------------------------@
OLTextGetSpecVisObj method dynamic OLTextClass, \
MSG_SPEC_GET_SPECIFIC_VIS_OBJECT
clr cx ;assume querying for win group
clr dx ; part (we'll return null)
test bp, mask SBF_WIN_GROUP ;doing win group
jnz exit ;exit if so
mov cx, ds:[0] ;else assume we return ourselves
mov dx, si
test ds:[di].OLTDI_specState, mask TDSS_IN_VIEW or \
mask TDSS_IN_COMPOSITE
jz exit ;not in a view, we're done
mov dx, ds:[di].OLTDI_viewObj ;else return view object
exit:
stc ;return carry set
ret
OLTextGetSpecVisObj endm
COMMENT @----------------------------------------------------------------------
METHOD: OLTextVupCreateGState --
MSG_VIS_VUP_CREATE_GSTATE for OLTextClass
DESCRIPTION: Creates GState for this object.
PASS: *ds:si - instance data
es - segment of MetaClass
ax - MSG_VIS_VUP_CREATE_GSTATE
RETURN: bp - GState
carry set if handled
DESTROYED: bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 10/21/99 Initial revision
------------------------------------------------------------------------------@
OLTextVupCreateGState method dynamic OLTextClass, \
MSG_VIS_VUP_CREATE_GSTATE
mov di, offset OLTextClass
call ObjCallSuperNoLock
jnc exit
mov di, ds:[si]
add di, ds:[di].Vis_offset
test ds:[di].OLTDI_specState, mask TDSS_EDITABLE
jz done
push cx, ds
segmov ds, dgroup, di
mov cx, ds:[editableTextFontID]
jcxz donePop
push ax, dx
mov dx, ds:[editableTextFontsize]
clr ah
mov di, bp ; di = gstate
call GrSetFont
pop ax, dx
donePop:
pop cx, ds
done:
stc
exit:
ret
OLTextVupCreateGState endm
Build ends
|
; A127648: Triangle read by rows: row n consists of n zeros followed by n+1.
; 1,0,2,0,0,3,0,0,0,4,0,0,0,0,5,0,0,0,0,0,6,0,0,0,0,0,0,7,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,10,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,0,13,0,0,0,0,0,0,0,0,0
mov $1,1
lpb $0
add $1,1
sub $0,$1
lpe
lpb $0
mov $0,0
mov $1,0
lpe
mov $0,$1
|
# APPLE LOCAL file 4099000
#ifndef __x86_64__
#define THUNK(REG) \
.private_extern ___i686.get_pc_thunk.REG ;\
___i686.get_pc_thunk.REG: ;\
movl (%esp,1),%REG ;\
ret ;
#ifdef L_get_pc_thunk_ax
THUNK(eax)
#endif
#ifdef L_get_pc_thunk_dx
THUNK(edx)
#endif
#ifdef L_get_pc_thunk_cx
THUNK(ecx)
#endif
#ifdef L_get_pc_thunk_bx
THUNK(ebx)
#endif
#ifdef L_get_pc_thunk_si
THUNK(esi)
#endif
#ifdef L_get_pc_thunk_di
THUNK(edi)
#endif
#ifdef L_get_pc_thunk_bp
THUNK(ebp)
#endif
#endif
|
/*
* GridTools
*
* Copyright (c) 2014-2021, ETH Zurich
* All rights reserved.
*
* Please, refer to the LICENSE file in the root directory.
* SPDX-License-Identifier: BSD-3-Clause
*/
#pragma once
#include <cassert>
#include <type_traits>
#include <utility>
#include "../common/defs.hpp"
#include "../common/functional.hpp"
#include "../common/host_device.hpp"
#include "../common/integral_constant.hpp"
#include "../common/tuple.hpp"
#include "../meta/type_traits.hpp"
#include "concept.hpp"
namespace gridtools {
namespace sid {
namespace loop_impl_ {
template <class Key, class T>
struct generic_loop {
static_assert(std::is_signed<T>::value, GT_INTERNAL_ERROR);
T m_num_steps;
T m_step;
template <class Fun>
struct loop_f {
Fun m_fun;
T m_num_steps;
T m_step;
template <class Ptr, class Strides>
void GT_FUNCTION operator()(Ptr &&ptr, Strides const &strides) const {
assert(m_num_steps >= 0);
if (m_num_steps <= 0)
return;
auto &&stride = get_stride<Key>(strides);
for (T i = 0; i < m_num_steps; ++i) {
m_fun(ptr, strides);
shift(ptr, stride, m_step);
}
shift(wstd::forward<Ptr>(ptr), stride, -m_step * m_num_steps);
}
};
template <class Fun>
GT_CONSTEXPR GT_FUNCTION loop_f<Fun> operator()(Fun &&fun) const {
return {wstd::forward<Fun>(fun), m_num_steps, m_step};
}
template <class Outer>
struct cursor_f {
Outer m_outer;
T m_num_steps;
T m_step;
T m_pos;
template <class Ptr, class Strides>
void GT_FUNCTION next(Ptr &&ptr, Strides const &strides) {
assert(m_num_steps >= 0);
if (m_num_steps <= 0)
return;
if (++m_pos == m_num_steps) {
shift(ptr, get_stride<Key>(strides), m_step * (1 - m_num_steps));
m_pos = 0;
m_outer.next(wstd::forward<Ptr>(ptr), strides);
} else {
shift(wstd::forward<Ptr>(ptr), get_stride<Key>(strides), m_step);
}
}
GT_FUNCTION bool done() const { return m_num_steps <= 0 || m_outer.done(); }
};
template <class Outer>
GT_CONSTEXPR GT_FUNCTION cursor_f<Outer> make_cursor(Outer &&outer) const {
return {wstd::forward<Outer>(outer), m_num_steps, m_step, 0};
}
struct outer_most_cursor_f {
T m_step;
T m_pos;
template <class Ptr, class Strides>
void GT_FUNCTION next(Ptr &&ptr, Strides const &strides) {
--m_pos;
shift(wstd::forward<Ptr>(ptr), get_stride<Key>(strides), m_step);
}
GT_FUNCTION bool done() const { return m_pos > 0; }
};
GT_CONSTEXPR GT_FUNCTION outer_most_cursor_f make_cursor() const { return {m_step, m_num_steps}; }
};
template <class Key, class T, ptrdiff_t Step>
struct known_step_loop {
static_assert(std::is_signed<T>::value, GT_INTERNAL_ERROR);
T m_num_steps;
template <class Fun>
struct loop_f {
Fun m_fun;
T m_num_steps;
template <class Ptr, class Strides>
void GT_FUNCTION operator()(Ptr &&ptr, Strides const &strides) const {
assert(m_num_steps >= 0);
if (m_num_steps <= 0)
return;
auto &&stride = get_stride<Key>(strides);
for (T i = 0; i < m_num_steps; ++i) {
m_fun(ptr, strides);
shift(ptr, stride, integral_constant<T, Step>{});
}
static constexpr T minus_step = -Step;
shift(wstd::forward<Ptr>(ptr), stride, minus_step * m_num_steps);
}
};
template <class Fun>
GT_FUNCTION loop_f<Fun> operator()(Fun &&fun) const {
return {wstd::forward<Fun>(fun), m_num_steps};
}
template <class Outer>
struct cursor_f {
Outer m_outer;
T m_num_steps;
T m_pos;
template <class Ptr, class Strides>
void GT_FUNCTION next(Ptr &&ptr, Strides const &strides) {
assert(m_num_steps >= 0);
if (m_num_steps <= 0)
return;
if (++m_pos == m_num_steps) {
shift(ptr, get_stride<Key>(strides), Step * (1 - m_num_steps));
m_pos = 0;
m_outer.next(wstd::forward<Ptr>(ptr), strides);
} else {
shift(wstd::forward<Ptr>(ptr), get_stride<Key>(strides), integral_constant<T, Step>{});
}
}
GT_FUNCTION bool done() const { return m_num_steps <= 0 || m_outer.done(); }
};
template <class Outer>
GT_CONSTEXPR GT_FUNCTION cursor_f<Outer> make_cursor(Outer &&outer) const {
return {wstd::forward<Outer>(outer), m_num_steps, 0};
}
struct outer_most_cursor_f {
T m_pos;
template <class Ptr, class Strides>
void GT_FUNCTION next(Ptr &&ptr, Strides const &strides) {
--m_pos;
shift(wstd::forward<Ptr>(ptr), get_stride<Key>(strides), integral_constant<T, Step>{});
}
GT_FUNCTION bool done() const { return m_pos > 0; }
};
GT_CONSTEXPR GT_FUNCTION outer_most_cursor_f make_cursor() const { return {m_num_steps}; }
};
template <class Key, class T>
struct known_step_loop<Key, T, 0> {
static_assert(std::is_signed<T>::value, GT_INTERNAL_ERROR);
T m_num_steps;
template <class Fun>
struct loop_f {
Fun m_fun;
T m_num_steps;
template <class Ptr, class Strides>
void GT_FUNCTION operator()(Ptr &&ptr, const Strides &strides) const {
assert(m_num_steps >= 0);
for (T i = 0; i < m_num_steps; ++i)
m_fun(wstd::forward<Ptr>(ptr), strides);
}
};
template <class Fun>
GT_CONSTEXPR GT_FUNCTION loop_f<Fun> operator()(Fun &&fun) const {
return {wstd::forward<Fun>(fun), m_num_steps};
}
template <class Outer>
struct cursor_f {
Outer m_outer;
T m_num_steps;
T m_pos;
template <class Ptr, class Strides>
void GT_FUNCTION next(Ptr &&ptr, Strides const &strides) {
assert(m_num_steps >= 0);
if (m_num_steps <= 0)
return;
if (++m_pos == m_num_steps) {
m_pos = 0;
m_outer.next(wstd::forward<Ptr>(ptr), strides);
}
}
GT_FUNCTION bool done() const { return m_num_steps <= 0 || m_outer.done(); }
};
template <class Outer>
GT_CONSTEXPR GT_FUNCTION cursor_f<Outer> make_cursor(Outer &&outer) const {
return {wstd::forward<Outer>(outer), m_num_steps, 0};
}
struct outer_most_cursor_f {
T m_pos;
template <class Ptr, class Strides>
void GT_FUNCTION next(Ptr &&, Strides const &) {
--m_pos;
}
GT_FUNCTION bool done() const { return m_pos > 0; }
};
GT_CONSTEXPR GT_FUNCTION outer_most_cursor_f make_cursor() const { return {m_num_steps}; }
};
template <class Key, class T, T NumSteps>
struct known_num_steps_loop {
static_assert(std::is_signed<T>::value, GT_INTERNAL_ERROR);
T m_step;
template <class Fun>
struct loop_f {
Fun m_fun;
T m_step;
template <class Ptr, class Strides>
void GT_FUNCTION operator()(Ptr &&ptr, const Strides &strides) const {
auto &&stride = get_stride<Key>(strides);
// TODO(anstaf): to figure out if for_each<make_indices_c<NumSteps>>(...) produces better code.
for (T i = 0; i < NumSteps; ++i) {
m_fun(ptr, strides);
shift(ptr, stride, m_step);
}
static constexpr T minus_num_steps = -NumSteps;
shift(wstd::forward<Ptr>(ptr), stride, m_step * minus_num_steps);
}
};
template <class Fun>
GT_CONSTEXPR GT_FUNCTION loop_f<Fun> operator()(Fun &&fun) const {
return {wstd::forward<Fun>(fun), m_step};
}
template <class Outer>
struct cursor_f {
Outer m_outer;
T m_step;
T m_pos;
template <class Ptr, class Strides>
void GT_FUNCTION next(Ptr &&ptr, Strides const &strides) {
if (++m_pos == NumSteps) {
constexpr T num_steps_back = 1 - NumSteps;
shift(ptr, get_stride<Key>(strides), m_step * num_steps_back);
m_pos = 0;
m_outer.next(wstd::forward<Ptr>(ptr), strides);
} else {
shift(wstd::forward<Ptr>(ptr), get_stride<Key>(strides), m_step);
}
}
GT_FUNCTION bool done() const { return m_outer.done(); }
};
template <class Outer>
GT_CONSTEXPR GT_FUNCTION cursor_f<Outer> make_cursor(Outer &&outer) const {
return {wstd::forward<Outer>(outer), m_step, 0};
}
struct outer_most_cursor_f {
T m_step;
T m_pos;
template <class Ptr, class Strides>
void GT_FUNCTION next(Ptr &&ptr, Strides const &strides) {
--m_pos;
shift(wstd::forward<Ptr>(ptr), get_stride<Key>(strides), m_step);
}
GT_FUNCTION bool done() const { return m_pos > 0; }
};
GT_CONSTEXPR GT_FUNCTION outer_most_cursor_f make_cursor() const { return {m_step, NumSteps}; }
};
template <class Key, class T, ptrdiff_t NumSteps, ptrdiff_t Step>
struct all_known_loop {
static_assert(std::is_signed<T>::value, GT_INTERNAL_ERROR);
template <class Fun>
struct loop_f {
Fun m_fun;
template <class Ptr, class Strides>
void GT_FUNCTION operator()(Ptr &&ptr, const Strides &strides) const {
auto &&stride = get_stride<Key>(strides);
for (T i = 0; i < (T)NumSteps; ++i) {
m_fun(ptr, strides);
shift(ptr, stride, integral_constant<T, Step>{});
}
shift(wstd::forward<Ptr>(ptr), stride, integral_constant<T, -Step * NumSteps>{});
}
};
template <class Fun>
GT_CONSTEXPR GT_FUNCTION loop_f<Fun> operator()(Fun &&fun) const {
return {wstd::forward<Fun>(fun)};
}
template <class Outer>
struct cursor_f {
Outer m_outer;
T m_pos;
template <class Ptr, class Strides>
void GT_FUNCTION next(Ptr &&ptr, Strides const &strides) {
if (++m_pos == NumSteps) {
constexpr T offset_back = Step * (1 - NumSteps);
shift(ptr, get_stride<Key>(strides), offset_back);
m_pos = 0;
m_outer.next(wstd::forward<Ptr>(ptr), strides);
} else {
shift(wstd::forward<Ptr>(ptr), get_stride<Key>(strides), Step);
}
}
GT_FUNCTION bool done() const { return m_outer.done(); }
};
template <class Outer>
GT_CONSTEXPR GT_FUNCTION cursor_f<Outer> make_cursor(Outer &&outer) const {
return {wstd::forward<Outer>(outer), 0};
}
struct outer_most_cursor_f {
T m_pos;
template <class Ptr, class Strides>
void GT_FUNCTION next(Ptr &&ptr, Strides const &strides) {
--m_pos;
shift(wstd::forward<Ptr>(ptr), get_stride<Key>(strides), Step);
}
GT_FUNCTION bool done() const { return m_pos > 0; }
};
GT_CONSTEXPR GT_FUNCTION outer_most_cursor_f make_cursor() const { return {NumSteps}; }
};
template <class Key, class T, ptrdiff_t NumSteps>
struct all_known_loop<Key, T, NumSteps, 0> {
static_assert(std::is_signed<T>::value, GT_INTERNAL_ERROR);
template <class Fun>
struct loop_f {
Fun m_fun;
template <class Ptr, class Strides>
void GT_FUNCTION operator()(Ptr &&ptr, Strides const &strides) const {
for (T i = 0; i < (T)NumSteps; ++i)
m_fun(ptr, strides);
}
};
template <class Fun>
GT_CONSTEXPR GT_FUNCTION loop_f<Fun> operator()(Fun &&fun) const {
return {wstd::forward<Fun>(fun)};
}
template <class Outer>
struct cursor_f {
Outer m_outer;
T m_pos;
template <class Ptr, class Strides>
void GT_FUNCTION next(Ptr &&ptr, Strides const &strides) {
if (++m_pos == NumSteps) {
m_pos = 0;
m_outer.next(wstd::forward<Ptr>(ptr), strides);
}
}
GT_FUNCTION bool done() const { return m_outer.done(); }
};
template <class Outer>
GT_CONSTEXPR GT_FUNCTION cursor_f<Outer> make_cursor(Outer &&outer) const {
return {wstd::forward<Outer>(outer), 0};
}
struct outer_most_cursor_f {
T m_pos;
template <class Ptr, class Strides>
void GT_FUNCTION next(Ptr &&, Strides const &) {
--m_pos;
}
GT_FUNCTION bool done() const { return m_pos > 0; }
};
GT_CONSTEXPR GT_FUNCTION outer_most_cursor_f make_cursor() const { return {NumSteps}; }
};
template <class Key, class T>
struct all_known_loop<Key, T, 1, 0> {
static_assert(std::is_signed<T>::value, GT_INTERNAL_ERROR);
template <class Fun>
GT_CONSTEXPR GT_FUNCTION Fun operator()(Fun &&fun) const {
return fun;
}
template <class Outer>
GT_CONSTEXPR GT_FUNCTION Outer make_cursor(Outer &&outer) const {
return wstd::forward<Outer>(outer);
}
struct outer_most_cursor_f {
bool m_done;
template <class Ptr, class Strides>
void GT_FUNCTION next(Ptr &&, Strides const &) {
m_done = true;
}
GT_FUNCTION bool done() const { return m_done; }
};
GT_CONSTEXPR GT_FUNCTION outer_most_cursor_f make_cursor() const { return {false}; }
};
template <class Key, class T>
struct all_known_loop<Key, T, 0, 0> {
static_assert(std::is_signed<T>::value, GT_INTERNAL_ERROR);
template <class Fun>
GT_CONSTEXPR GT_FUNCTION gridtools::host_device::noop operator()(Fun &&) const {
return {};
}
struct cursor_f {
template <class Ptr, class Strides>
void GT_FUNCTION next(Ptr &&, Strides const &) {}
GT_FUNCTION bool done() const { return true; }
};
template <class... Ts>
GT_CONSTEXPR GT_FUNCTION cursor_f make_cursor(Ts &&...) const {
return {};
}
};
struct make_cursor_f {
template <class Cursor, class Loop>
GT_CONSTEXPR GT_FUNCTION auto operator()(Cursor &&cursor, Loop const &loop) const {
return loop.make_cursor(wstd::forward<Cursor>(cursor));
}
};
template <class Loops>
GT_CONSTEXPR GT_FUNCTION auto make_cursor_r(Loops &&loops) {
return tuple_util::host_device::fold(make_cursor_f{},
tuple_util::host_device::get<0>(wstd::forward<Loops>(loops)).make_cursor(),
tuple_util::host_device::drop_front<1>(wstd::forward<Loops>(loops)));
}
template <class Loops>
GT_CONSTEXPR GT_FUNCTION auto make_cursor(Loops &&loops) {
return make_cursor_r(tuple_util::host_device::reverse(wstd::forward<Loops>(loops)));
}
template <class Ptr, class Strides, class Cursor>
struct range {
Ptr m_ptr;
Strides const &m_strides;
Cursor m_cursor;
GT_FUNCTION decltype(auto) operator*() const { return *m_ptr; }
GT_FUNCTION void operator++() { m_cursor.next(m_ptr, m_strides); }
template <class T>
GT_FUNCTION bool operator!=(T &&) const {
return m_cursor.done();
}
range begin() const { return *this; }
range end() const { return *this; }
};
template <class Ptr, class Strides, class Cursor>
GT_CONSTEXPR GT_FUNCTION range<Ptr, Strides const &, Cursor> make_range(
Ptr ptr, Strides const &strides, Cursor &&cursor) {
return {wstd::move(ptr), strides, wstd::forward<Cursor>(cursor)};
}
} // namespace loop_impl_
/**
* A set of `make_loop<Key>(num_steps, step = 1)` overloads
*
* @tparam I dimension index
* @param num_steps number of iterations in the loop. Can be of integral or integral_constant type
* @param step (optional) a step for each iteration. Can be of integral or integral_constant type.
* The default is integral_constant<int, 1>
* @return a functor that accepts another functor with the signature: `void(Ptr&&, Strides const&)` and
* returns a functor also with the same signature.
*
* Usage:
* 1. One dimensional traversal:
* ```
* // let us assume that we have a sid with stride dimension tags `i`, `j` and `k`.
*
* // define the way we are going to traverse the data
* auto loop = sid::make_loop<k>(32);
*
* // define what we are going to do with the data
* auto loop_body = [](auto& ptr, auto const& strides) { ... }
*
* // bind traversal description with the body
* auto the_concrete_loop = loop(loop_body);
*
* // execute the loop on the provided data
* the_concrete_loop(the_origin_of_my_data, the_strides_of_my_data);
* ```
*
* 2. Multi dimensional traversal:
* ```
* // define traversal path: k dimension is innermost and will be traversed backward
* auto multi_loop = compose(
* sid::make_loop<i>(i_size),
* sid::make_loop<j>(j_size),
* sid::make_loop<k>(k_size, -1_c));
*
* // define what we are going to do with the data
* auto loop_body = [](auto& ptr, auto const& strides) { ... }
*
* // bind traversal description with the body
* auto the_concrete_loop = multi_loop(loop_body);
*
* auto ptr = the_origin_of_my_data;
* // first move the pointer to the end of data in k-direction
* sid::shift(ptr, sid::get_strides<2>(the_strides_of_my_data), 1_c - k_size);
*
* // execute the loop on the provided data
* the_concrete_loop(ptr, the_strides_of_my_data);
* ```
* Rationale:
*
* The goal of the design is to separate traversal description (dimensions order, numbers of steps,
* traversal directions), the body of the loop and the structure of the concrete data (begin point, strides)
* into orthogonal components.
*
* Overloads:
*
* `make_loop` goes with the large number of overloads to benefit from the fact that some aspects of
* traversal description are known in compile time.
*/
template <class Key,
class T1,
class T2,
class T = std::common_type_t<T1, T2>,
std::enable_if_t<std::is_integral<T1>::value && std::is_integral<T2>::value, int> = 0>
GT_CONSTEXPR GT_FUNCTION loop_impl_::generic_loop<Key, std::make_signed_t<T>> make_loop(T1 num_steps, T2 step) {
return {num_steps, step};
}
template <class Key,
class T1,
class T2 = int,
T2 Step = 1,
class T = std::common_type_t<T1, T2>,
std::enable_if_t<std::is_integral<T1>::value, int> = 0>
GT_CONSTEXPR GT_FUNCTION loop_impl_::known_step_loop<Key, std::make_signed_t<T>, Step> make_loop(
T1 num_steps, std::integral_constant<T2, Step> = {}) {
return {num_steps};
}
template <class Key,
class T1,
T1 NumStepsV,
class T2,
class T = std::common_type_t<T1, T2>,
std::enable_if_t<std::is_integral<T1>::value && (NumStepsV > 1), int> = 0>
GT_CONSTEXPR GT_FUNCTION loop_impl_::known_num_steps_loop<Key, std::make_signed_t<T>, NumStepsV> make_loop(
std::integral_constant<T1, NumStepsV>, T2 step) {
return {step};
}
template <class Key,
class T1,
T1 NumStepsV,
class T2,
class T = std::common_type_t<T1, T2>,
std::enable_if_t<std::is_integral<T1>::value && (NumStepsV == 0 || NumStepsV == 1), int> = 0>
GT_CONSTEXPR GT_FUNCTION loop_impl_::all_known_loop<Key, std::make_signed_t<T>, NumStepsV, 0> make_loop(
std::integral_constant<T1, NumStepsV>, T2) {
return {};
}
template <class Key,
class T1,
T1 NumStepsV,
class T2 = int,
T2 StepV = 1,
class T = std::common_type_t<T1, T2>,
std::enable_if_t<(NumStepsV >= 0), int> = 0>
GT_CONSTEXPR
GT_FUNCTION loop_impl_::all_known_loop<Key, std::make_signed_t<T>, NumStepsV, (NumStepsV > 1) ? StepV : 0>
make_loop(std::integral_constant<T1, NumStepsV>, std::integral_constant<T2, StepV> = {}) {
return {};
}
/**
* A helper that allows to use `SID`s with C++11 range based loop
*
* Example:
*
* using namespace gridtools::sid;
*
* double data[3][4][5];
*
* for(auto& ref : make_range(get_origin(data), get_strides(data),
* make_loop<i>(3_c), make_loop<j>(4_c), make_loop<k>(5_c))) {
* ref = 42;
* }
*/
template <class Ptr, class Strides, class OuterMostLoop, class... Loops>
GT_CONSTEXPR GT_FUNCTION auto make_range(
Ptr ptr, Strides const &strides, OuterMostLoop &&outer_most_loop, Loops &&... loops) {
return loop_impl_::make_range(wstd::move(ptr),
strides,
loop_impl_::make_cursor(tuple<OuterMostLoop, Loops...>{
wstd::forward<OuterMostLoop>(outer_most_loop), wstd::forward<Loops>(loops)...}));
}
} // namespace sid
} // namespace gridtools
|
; ===============================================================
; Mar 2014
; ===============================================================
;
; size_t w_array_append(w_array_t *a, void *item)
;
; Append word to end of array, return index of appended word.
;
; ===============================================================
SECTION code_adt_w_array
PUBLIC asm_w_array_append, asm0_w_array_append
EXTERN asm_b_array_append_block, error_mc
asm_w_array_append:
; enter : hl = array *
; bc = item
;
; exit : bc = item
;
; success
;
; de = & array.data[idx]
; hl = idx of appended word
; carry reset
;
; fail
;
; hl = -1
; carry set
;
; uses : af, de, hl
inc hl
inc hl ; hl = & array.size
asm0_w_array_append:
ld e,(hl)
inc hl
ld d,(hl) ; de = array.size (bytes)
inc hl ; hl = & array.capacity (bytes)
ld a,(hl)
inc hl
cp e
jr nz, room_available ; if size != capacity
ld a,(hl)
cp d
jp z, error_mc ; if size == capacity
room_available:
; bc = item
; hl = & array.capacity + 1b
; de = array.size (bytes)
inc de
inc de ; size += 2
dec hl
dec hl ; hl = & array.size + 1b
ld (hl),d
dec hl
ld (hl),e ; array.size += 2
dec hl
ld a,(hl)
dec hl
ld l,(hl)
ld h,a ; hl = array.data
dec de
add hl,de
ld (hl),b
dec hl ; hl = & array.data[idx]
ld (hl),c ; append item
dec de ; de = idx of appended item in bytes
ex de,hl ; hl = idx in bytes, de = & array.data[idx]
srl h
rr l ; hl = idx in words
ret
|
; A059338: a(n) = Sum_{k=1..n} k^5 * binomial(n,k).
; Submitted by Jamie Morken(w4)
; 1,34,342,2192,11000,47232,181888,646144,2156544,6848000,20877824,61526016,176171008,492126208,1345536000,3610247168,9526771712,24769069056,63546720256,161087488000,403925630976,1002841309184,2467290939392,6019866427392,14575206400000,35039249170432,83681699954688,198628547231744,468778634706944,1100451151872000,2570377939124224,5975570819055616,13830537722462208,31877668177707008,73185168982016000,167394666734419968,381529126088998912,866682893768851456,1962511157591801856,4430482104123392000
add $0,1
mov $1,1
mov $4,$0
mov $5,10
lpb $0
sub $0,1
mov $2,$1
pow $2,5
mov $3,$4
bin $3,$1
add $1,1
mul $3,$2
add $5,$3
lpe
mov $0,$5
sub $0,10
|
10 ORG 100H
20 JP MAIN
30PUTSTR EQU 0BFF1H
40INKEY EQU 0BE53H
50PUTCHR EQU 0BE62H
60WAITK EQU 0BFCDH
70RPTCHR EQU 0BFEEH
80ENCRYP EQU 1
90DECRYP EQU 0
100N1: DB 0,0,0,0
110N2: DB 0,0,0,0
120TMP1: DB 0,0,0,0
130TMP2: DB 0,0,0,0
140ROUND: DB 0
150BLOCK: DEFS 8
160OPE: DB 0
170MAIN: LD A,23
180 CALL MOD8
190 LD (N1),A
200 RET
210RawCrp: ; RawCrypt
220 ; N1 = uchar2ulong(block + 0);
230 LD DE,N1
240 LD HL,BLOCK
250 LD A,(HL)
260 LD (DE),A
270 INC HL
280 INC DE
290 LD A,(HL)
300 LD (DE),A
310 INC HL
320 INC DE
330 LD A,(HL)
340 LD (DE),A
350 INC HL
360 INC DE
370 LD A,(HL)
380 LD (DE),A
390 INC HL
400 ; N2 = uchar2ulong(block + 4);
410 LD DE,N2
420 LD A,(HL)
430 LD (DE),A
440 INC HL
450 INC DE
460 LD A,(HL)
470 LD (DE),A
480 INC HL
490 INC DE
500 LD A,(HL)
510 LD (DE),A
520 INC HL
530 INC DE
540 LD A,(HL)
550 LD (DE),A
560 ; round = (operation == OPERATION_ENCRYPT) ? 0 : 31;
570 LD A,(OPE)
580 CP DECRYP
590 JP Z,MAIN00
600 LD A,31
610MAIN00: LD (ROUND),A
620MAIN01: ;do {
630 ; if (round < 24) TMP1 = N1 + X[round % 8];
640 CP 25
650 JP P,MAIN02
660 CALL MOD8 ; round % 8
670 ADD A,A
680 ADD A,A ; (round % 8) * 4
?LD A,(N1+3)
690MAIN02:
3999 RET
4000MOD8: ; modulo 8
4010 ; In A, out A
4020 CP 8
4030 RET M
4040 PUSH AF
4050 RRA
4060 RRA
4070 RRA
4080 AND 1FH ; / 8
4100 ADD A,A
4110 ADD A,A
4120 ADD A,A ; * 8
4140 LD B,A
4150 POP AF
4160 SUB B
4170 RET
5000X: DEFS 32 ; the key (KMU)
5010LBlock: DEFS 8 ; for CBC chaining
5020K12: DB 0D0H, 0CFH, 0CEH, 0CDH, 0CCH, 0CBH, 0CAH, 0C9H
5030 DB 0C8H, 0C7H, 0C6H, 0C5H, 0C4H, 0C3H, 0C2H, 0C1H
5040 DB 0C0H, 0BFH, 0BEH, 0BDH, 0BCH, 0BBH, 0BAH, 0B9H
5050 DB 0B8H, 0B7H, 0B6H, 0B5H, 0B4H, 0B3H, 0B2H, 0B1H
5060 DB 0B0H, 0AFH, 0AEH, 0ADH, 0ACH, 0ABH, 0AAH, 0A9H
5070 DB 0A8H, 0A7H, 0A6H, 0A5H, 0A4H, 0A3H, 0A2H, 0A1H
5080 DB 0A0H, 9FH, 9EH, 9DH, 9CH, 9BH, 9AH, 99H
5090 DB 98H, 97H, 96H, 95H, 94H, 93H, 92H, 91H
5100 DB 90H, 8FH, 8EH, 8DH, 8CH, 8BH, 8AH, 89H
5110 DB 88H, 87H, 86H, 85H, 84H, 83H, 82H, 81H
5120 DB 80H, 7FH, 7EH, 7DH, 7CH, 7BH, 7AH, 79H
5130 DB 78H, 77H, 76H, 75H, 74H, 73H, 72H, 71H
5140 DB 70H, 6FH, 6EH, 6DH, 6CH, 6BH, 6AH, 69H
5150 DB 68H, 67H, 66H, 65H, 64H, 63H, 62H, 61H
5160 DB 60H, 5FH, 5EH, 5DH, 5CH, 5BH, 46H, 47H
5170 DB 48H, 49H, 4AH, 4BH, 4CH, 4DH, 4EH, 4FH
5180 DB 50H, 51H, 52H, 53H, 54H, 55H, 56H, 57H
5190 DB 58H, 59H, 00H, 00H, 00H, 00H, 00H, 00H
5200 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
5210 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
5220 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
5230 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
5240 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
5250 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
5260 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
5270 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
5280 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
5290 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
5300 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
5310 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
5320 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
5330 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
5340K34: DB 8CH, 8BH, 8AH, 89H, 88H, 87H, 86H, 85H
5350 DB 84H, 83H, 82H, 81H, 80H, 7FH, 7EH, 7DH
5360 DB 7CH, 7BH, 7AH, 79H, 78H, 77H, 76H, 75H
5370 DB 74H, 73H, 72H, 71H, 70H, 6FH, 6EH, 6DH
5380 DB 6CH, 6BH, 6AH, 69H, 68H, 67H, 66H, 65H
5390 DB 64H, 63H, 62H, 61H, 60H, 5FH, 5EH, 5DH
5400 DB 5CH, 5BH, 5AH, 59H, 58H, 57H, 56H, 55H
5410 DB 54H, 53H, 52H, 51H, 50H, 4FH, 4EH, 4DH
5420 DB 4CH, 4BH, 4AH, 49H, 48H, 47H, 46H, 45H
5430 DB 44H, 43H, 42H, 41H, 40H, 3FH, 3EH, 3DH
5440 DB 3CH, 3BH, 3AH, 39H, 38H, 37H, 36H, 35H
5450 DB 34H, 33H, 32H, 31H, 30H, 2FH, 2EH, 2DH
5460 DB 2CH, 2BH, 2AH, 29H, 28H, 27H, 26H, 25H
5470 DB 24H, 23H, 22H, 21H, 20H, 1FH, 1EH, 1DH
5480 DB 1CH, 1BH, 1AH, 19H, 18H, 17H, 16H, 15H
5490 DB 14H, 13H, 12H, 11H, 10H, 0FH, 0EH, 0DH
5500 DB 0CH, 0BH, 0AH, 09H, 08H, 07H, 06H, 05H
5510 DB 04H, 03H, 02H, 01H, 00H, 0FFH, 0FEH, 0FDH
5520 DB 0FCH, 0FBH, 0FAH, 0F9H, 0F8H, 0F7H, 0F6H, 0F5H
5530 DB 0F4H, 0F3H, 0F2H, 0F1H, 0F0H, 0EFH, 0EEH, 0EDH
5540 DB 0ECH, 0EBH, 0EAH, 0E9H, 0E8H, 0E7H, 0E6H, 0E5H
5550 DB 0E4H, 0E3H, 0E2H, 0E1H, 0E0H, 0DFH, 0DEH, 0DDH
5560 DB 0DCH, 0DBH, 0DAH, 0D9H, 0D8H, 0D7H, 0D6H, 0D5H
5570 DB 0D4H, 0D3H, 0D2H, 0D1H, 0D0H, 0CFH, 0CEH, 0CDH
5580 DB 0CCH, 0CBH, 0CAH, 0C9H, 0C8H, 0C7H, 0C6H, 0C5H
5590 DB 0C4H, 0C3H, 0C2H, 0C1H, 0C0H, 0BFH, 0BEH, 0BDH
5600 DB 0BCH, 0BBH, 0BAH, 0B9H, 0B8H, 0B7H, 0B6H, 0B5H
5610 DB 0B4H, 0B3H, 0B2H, 0B1H, 0B0H, 0AFH, 0AEH, 0ADH
5620 DB 0ACH, 0ABH, 0AAH, 0A9H, 0A8H, 0A7H, 0A6H, 0A5H
5630 DB 0A4H, 0A3H, 00H, 00H, 00H, 00H, 00H, 00H
5640 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
5650 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
5660K56: DB 78H, 77H, 76H, 75H, 74H, 73H, 72H, 71H
5670 DB 70H, 6FH, 6EH, 6DH, 6CH, 6BH, 6AH, 69H
5680 DB 68H, 67H, 66H, 65H, 64H, 63H, 62H, 61H
5690 DB 60H, 5FH, 5EH, 5DH, 5CH, 5BH, 5AH, 59H
5700 DB 58H, 57H, 56H, 55H, 54H, 53H, 52H, 51H
5710 DB 50H, 4FH, 4EH, 4DH, 4CH, 4BH, 4AH, 49H
5720 DB 48H, 47H, 46H, 45H, 44H, 43H, 42H, 41H
5730 DB 40H, 3FH, 3EH, 3DH, 3CH, 3BH, 3AH, 39H
5740 DB 38H, 37H, 36H, 35H, 34H, 33H, 32H, 31H
5750 DB 30H, 2FH, 2EH, 2DH, 2CH, 2BH, 2AH, 29H
5760 DB 28H, 27H, 26H, 25H, 24H, 23H, 22H, 21H
5770 DB 20H, 1FH, 1EH, 1DH, 1CH, 1BH, 1AH, 19H
5780 DB 18H, 17H, 16H, 15H, 14H, 13H, 12H, 11H
5790 DB 10H, 0FH, 0EH, 0DH, 0CH, 0BH, 0AH, 09H
5800 DB 08H, 07H, 06H, 05H, 04H, 03H, 02H, 01H
5810 DB 00H, 0FFH, 0FEH, 0FDH, 0FCH, 0FBH, 0FAH, 0F9H
5820 DB 0F8H, 0F7H, 0F6H, 0F5H, 0F4H, 0F3H, 0F2H, 0F1H
5830 DB 0F0H, 0EFH, 0EEH, 0EDH, 0ECH, 0EBH, 0EAH, 0E9H
5840 DB 0E8H, 0E7H, 0E6H, 0E5H, 0E4H, 0E3H, 0E2H, 0E1H
5850 DB 0E0H, 0DFH, 0DEH, 0DDH, 0DCH, 0DBH, 0DAH, 0D9H
5860 DB 0D8H, 0D7H, 0D6H, 0D5H, 0D4H, 0D3H, 0D2H, 0D1H
5870 DB 0D0H, 0CFH, 0CEH, 0CDH, 00H, 00H, 00H, 00H
5880 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
5890 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
5900 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
5910 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
5920 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
5930 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
5940 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
5950 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
5960 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
5970 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
5980K78: DB 9EH, 9DH, 9CH, 9BH, 9AH, 99H, 98H, 97H
5990 DB 96H, 95H, 94H, 93H, 92H, 91H, 90H, 8FH
6000 DB 8EH, 8DH, 8CH, 8BH, 8AH, 89H, 88H, 87H
6010 DB 86H, 85H, 84H, 83H, 82H, 81H, 80H, 7FH
6020 DB 7EH, 7DH, 7CH, 7BH, 7AH, 79H, 78H, 77H
6030 DB 76H, 75H, 74H, 73H, 72H, 71H, 70H, 6FH
6040 DB 6EH, 6DH, 6CH, 6BH, 6AH, 69H, 68H, 67H
6050 DB 66H, 65H, 64H, 63H, 62H, 61H, 60H, 5FH
6060 DB 5EH, 5DH, 5CH, 5BH, 5AH, 59H, 58H, 57H
6070 DB 56H, 55H, 54H, 53H, 52H, 51H, 50H, 4FH
6080 DB 4EH, 4DH, 4CH, 4BH, 4AH, 49H, 48H, 47H
6090 DB 46H, 45H, 44H, 43H, 42H, 41H, 40H, 3FH
6100 DB 3EH, 3DH, 3CH, 3BH, 3AH, 39H, 38H, 37H
6110 DB 36H, 35H, 34H, 33H, 32H, 31H, 30H, 2FH
6120 DB 2EH, 2DH, 2CH, 2BH, 2AH, 29H, 28H, 27H
6130 DB 26H, 25H, 24H, 23H, 22H, 21H, 20H, 1FH
6140 DB 1EH, 1DH, 1CH, 1BH, 1AH, 19H, 18H, 17H
6150 DB 16H, 15H, 14H, 13H, 12H, 11H, 10H, 0FH
6160 DB 0EH, 0DH, 0CH, 0BH, 0AH, 09H, 08H, 07H
6170 DB 06H, 05H, 04H, 03H, 02H, 01H, 00H, 0FFH
6180 DB 0FEH, 0FDH, 0FCH, 0FBH, 0FAH, 0F9H, 0F8H, 0F7H
6190 DB 0F6H, 0F5H, 0F4H, 0F3H, 0F2H, 0F1H, 0F0H, 0EFH
6200 DB 0EEH, 0EDH, 0ECH, 0EBH, 0EAH, 0E9H, 0E8H, 0E7H
6210 DB 0E6H, 0E5H, 0E4H, 0E3H, 0E2H, 0E1H, 0E0H, 0DFH
6220 DB 0DEH, 0DDH, 0DCH, 0DBH, 0DAH, 0D9H, 0D8H, 0D7H
6230 DB 0D6H, 0D5H, 0D4H, 0D3H, 0D2H, 0D1H, 0D0H, 0CFH
6240 DB 0CEH, 0CDH, 0CCH, 0CBH, 0CAH, 0C9H, 0C8H, 0C7H
6250 DB 0C6H, 0C5H, 0C4H, 0C3H, 0C2H, 0C1H, 0C0H, 0BFH
6260 DB 0BEH, 0BDH, 0BCH, 0BBH, 0BAH, 0B9H, 0B8H, 0B7H
6270 DB 0B6H, 0B5H, 00H, 00H, 00H, 00H, 00H, 00H
6280 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
6290 DB 00H, 00H, 00H, 00H, 00H, 00H, 00H, 00H
|
;-----------------------------------------------------------------------------
; FICHERO: Conversiones.asm
;
; DESCRIPCION: Implementa rutinas de conversiones varias y utilidades.
;
; RUTINAS:
; --------
;
; - BYTE2ASCII_R18: Coge un numero de 8 bits con signo
; de r18 y lo guarda en DECIMAL en memoria, en X.
;
; - R16_2_X_HEX: Escribe dos digitos en hexadecimal en r16 en X
;
; - HEX_X_2_BIN: Pasa 2 bytes ascii en hexadecimal de X, y devuelve
; el valor en r16
;
; - HEX2BIN: Pasa un caracter ascii en r16, y lo devuelve como valor
; numerico en el nibble bajo en r16
; Al salir: C=0 si todo bien, C=1 si no es digito hex.
;
; - CERO_2_X: Guarda un byte a 0 en X e incrementa este.
;
; - TABLA_SEGUN_R16_A_Z: Pone en Z direccion segun la tabla en (Z) y temp
;
;-----------------------------------------------------------------------------
;--------------------------------------------------------
; - BYTE2ASCII_R18: Coge un numero de 8 bits sin signo
; de r18 y lo guarda en ascii en memoria, en X.
;
; MOD: Siempre imprime las decenas
;-----------------------------------------------------------------------------
BYTE2ASCII_R18:
; Centenas ----------------------
clr r17
byte2ascii_cents_loop:
mov temp,r18
subi temp,100
brmi byte2ascii_cents_fin ; Es negativo?
inc r17
mov r18,temp ; Se va descontando de r18
rjmp byte2ascii_cents_loop
byte2ascii_cents_fin:
; En r17: No imprimirlo si es cero:
tst r17
breq byte2ascii_cents_0
rcall LCD_R17_BIN2BCD
byte2ascii_cents_0:
; Decenas ----------------------
clr r17
byte2ascii_decs_loop:
mov temp,r18
subi temp,10
brmi byte2ascii_decs_fin ; Es negativo?
inc r17
mov r18,temp ; Se va descontando de r18
rjmp byte2ascii_decs_loop
byte2ascii_decs_fin:
; En r17:
; En r17: No imprimirlo si es cero:
; tst r17
; breq byte2ascii_decs_0
rcall LCD_R17_BIN2BCD
byte2ascii_decs_0:
; Unidades ----------------------
mov r17,r18 ; Ya solo quedan unidades
rcall LCD_R17_BIN2BCD
ret
;----------------------------------------------------
; R16_2_X_HEX
;
; Escribe dos digitos en hexadecimal en r16 en X
;----------------------------------------------------
R16_2_X_HEX:
push r16
mov r17,r16 ; Guardar byte a mostrar en r16
; Nibble superior:
swap r17
rcall LCD_LOW_NIBBLE_R17_2_R16_ASCII
st X+,r16
; Nibble inferior:
pop r16
push r16
mov r17,r16 ; Guardar byte a mostrar en r16
rcall LCD_LOW_NIBBLE_R17_2_R16_ASCII
st X+,r16
pop r16
ret
;----------------------------------------------------
; - HEX_X_2_BIN: Pasa 2 bytes ascii en hexadecimal
; de X, y devuelve el valor en r16
;----------------------------------------------------
HEX_X_2_BIN:
; Nibble alto:
ld r16,X+
rcall HEX2BIN
mov aux,r16
; Nibble bajo
ld r16,X+
rcall HEX2BIN
; Unir nibbles:
swap aux
andi aux,0xF0
andi r16,0x0F
or r16,aux
ret
;----------------------------------------------------
; - HEX2BIN: Pasa un caracter ascii en r16, y lo
; devuelve como valor numerico en el nibble
; bajo en r16. Si es A..F debe estar en mayusculas
;
; Al salir: C=0 si todo bien, C=1 si no es digito hex.
;----------------------------------------------------
HEX2BIN:
cpi r16,'0'
brlo HEX2BIN_ERR
cpi r16,'9'
brge HEX2BIN_NO_NUM
; Es un digito numerico:
subi r16,'0'
clc
ret
HEX2BIN_NO_NUM:
cpi r16,'A'
brlo HEX2BIN_ERR
cpi r16,'G'
brge HEX2BIN_ERR
; Es digito entre 'A' y 'F':
subi r16,('A'-10)
clc
ret
HEX2BIN_ERR:
; ERROR
clr r16
sec
ret
;----------------------------------------------------
; CERO_2_X
;
; Guarda un byte a 0 en X e incrementa este.
;
; Implementado como rutina por que se usa muchas veces
; en el codigo.
;----------------------------------------------------
CERO_2_X:
ldi temp,0
st X+,temp
ret
;----------------------------------------------------
; LCD_R17_BIN2BCD : 2 DIGITOS BCD
; Pasa el numero en r17 a decimal ASCII y lo guarda en X
;----------------------------------------------------
LCD_R17_BIN2BCD:
push r18
push r19
; Dividir r17 entre 10, resultado en r19
clr r19
mov r18,r17 ; Usar copia de r17 en r18
lcd_r17_bin2bcd_buc1:
subi r18,10
brmi lcd_r17_bin2bcd_buc1_fin
inc r19
rjmp lcd_r17_bin2bcd_buc1
lcd_r17_bin2bcd_buc1_fin:
ldi temp,10
add r18,temp ; En r18 tenemos las unidades
tst r19 ; Quitar 0 en decenas si lo hay...
breq lcd_r17_bin2bcd_no_decenas
; pasar las decenas en r19 a ASCII:
push r17
mov r17,r19
rcall LCD_LOW_NIBBLE_R17_2_R16_ASCII
st X+,r16
pop r17
lcd_r17_bin2bcd_no_decenas:
; pasar las unidades en r19 a ASCII:
mov r17,r18
rcall LCD_LOW_NIBBLE_R17_2_R16_ASCII
st X+,r16
pop r19
pop r18
ret
; -------------------------------------------------
; R1_R2_Decimal
;
; R1 = HIGH BYTE
; R2 = LOW BYTE
;
; Lo escribe en ram en (X)
; -------------------------------------------------
R1_R2_Decimal:
clr r0
; -------------------------------------------------
; R0_R1_R2_Decimal
;
; R0 = +High
; R1 = HIGH BYTE
; R2 = LOW BYTE
;
; Lo escribe en ram en (X)
; -------------------------------------------------
R0_R1_R2_Decimal:
clr r7 ; Indicador de todavia todos ceros
; Empezar por las cientos de miles:
; -------------------------------------
r1r2dec_haz_100000:
clr r17 ; Contador para digito
ldi r18, 0x01 ; MSB de 100.000
ldi r19, 0x86
ldi r20, 0xA0
r1r2dec_rst_100000:
; Es < 100000 ? Hacer la resta y segun el signo...
mov r4, r0
mov r5, r1
mov r6, r2
sub r6, r20
sbc r5, r19
sbc r4, r18
; CARRY=1 -> No
brcs r1r2dec_fin_100000
; Si:
mov r0,r4
mov r1,r5
mov r2,r6
inc r17
rjmp r1r2dec_rst_100000
r1r2dec_fin_100000:
tst r17
breq r1r2dec_haz_10000
rcall LCD_LOW_NIBBLE_R17_2_R16_ASCII
st X+, r16
ser r16
mov r7, r16
; Empezar por las decenas de millas:
; -------------------------------------
r1r2dec_haz_10000:
clr r17 ; Contador para digito
ldi r18, 0
ldi r19, high ( 10000 )
ldi r20, low ( 10000 )
r1r2dec_rst_10000:
; Es < 100000 ? Hacer la resta y segun el signo...
mov r4, r0
mov r5, r1
mov r6, r2
sub r6, r20
sbc r5, r19
sbc r4, r18
; CARRY=1 -> No
brcs r1r2dec_fin_10000
; Si:
mov r2,r6
mov r1,r5
mov r0,r4
inc r17
rjmp r1r2dec_rst_10000
r1r2dec_fin_10000:
sbrc r7, 0
rjmp r1r2dec_si_10000
tst r17
breq r1r2dec_haz_1000
r1r2dec_si_10000:
rcall LCD_LOW_NIBBLE_R17_2_R16_ASCII
st X+, r16
ser r16
mov r7, r16
; Los miles:
; -------------------------------------
r1r2dec_haz_1000:
clr r17 ; Contador para digito
ldi r18, high ( 1000 )
ldi r19, low ( 1000 )
r1r2dec_rst_1000:
; Es < 1000 ?
mov r4, r1
mov r5, r2
sub r5, r19
sbc r4, r18
; CARRY=1 -> No
brcs r1r2dec_fin_1000
; Si:
mov r2,r5
mov r1,r4
inc r17
rjmp r1r2dec_rst_1000
r1r2dec_fin_1000:
sbrc r7, 0
rjmp r1r2dec_si_1000
tst r17
breq r1r2dec_haz_100
r1r2dec_si_1000:
rcall LCD_LOW_NIBBLE_R17_2_R16_ASCII
st X+, r16
ser r16
mov r7, r16
; Centenares:
; -------------------------------------
r1r2dec_haz_100:
clr r17 ; Contador para digito
ldi r18, high ( 100 )
ldi r19, low ( 100 )
r1r2dec_rst_100:
; Es < 100 ?
mov r4, r1
mov r5, r2
sub r5, r19
sbc r4, r18
; CARRY=1 -> No
brcs r1r2dec_fin_100
; Si:
mov r2,r5
mov r1,r4
inc r17
rjmp r1r2dec_rst_100
r1r2dec_fin_100:
sbrc r7, 0
rjmp r1r2dec_si_100
tst r17
breq r1r2dec_haz_10
r1r2dec_si_100:
rcall LCD_LOW_NIBBLE_R17_2_R16_ASCII
st X+, r16
ser r16
mov r7, r16
; Decenas
; -------------------------------------
r1r2dec_haz_10:
clr r17 ; Contador para digito
ldi r19, 10
r1r2dec_rst_10:
; Es < 10 ?
cp r2, r19
brlt r1r2dec_fin_10
sub r2, r19
inc r17
rjmp r1r2dec_rst_10
r1r2dec_fin_10:
sbrc r7, 0
rjmp r1r2dec_si_10
tst r17
breq r1r2dec_haz_1
r1r2dec_si_10:
rcall LCD_LOW_NIBBLE_R17_2_R16_ASCII
st X+, r16
ser r16
mov r7, r16
; Y las unidades que queden:
r1r2dec_haz_1:
mov r17, r2
rcall LCD_LOW_NIBBLE_R17_2_R16_ASCII
st X+, r16
ret
|
#include <algorithm>
#include "Boundary.h"
Boundary::Boundary() {}
Boundary::Boundary(const Vector2& upleft, const Vector2& upright, const Vector2& lowleft, const Vector2& lowright) :
upper_left(upleft), upper_right(upright), lower_left(lowleft), lower_right(lowright) {
// Calculate parameters for equations for every edge
if ((upper_right.y - upper_left.y) == 0) {
a1 = upper_left.y;
b1 = 0;
} else {
a1 = (upper_right.y - upper_left.y)/(upper_right.x - upper_left.x);
b1 = (upper_left.x*a1 - upper_left.y);
}
if ((lower_right.x - upper_right.x) == 0) {
a2 = upper_right.x;
b2 = 0;
} else {
a2 = (lower_right.y - upper_right.y)/(lower_right.x - upper_right.x);
b2 = (upper_right.x*a2 - upper_right.y);
}
if ((lower_left.y - lower_right.y) == 0) {
a3 = lower_right.y;
b3 = 0;
} else {
a3 = (lower_left.y - lower_right.y)/(lower_left.x - lower_right.x);
b3 = (lower_right.x*a3 - lower_right.y);
}
if ((upper_left.x - lower_left.x) == 0) {
a4 = lower_left.x;
b4 = 0;
} else {
a4 = (upper_left.y - lower_left.y)/(upper_left.x - lower_left.x);
b4 = (lower_left.x*a4 - lower_left.y);
}
}
Boundary::~Boundary() {}
bool Boundary::inBounds(const Vector2& location) {
// Perpendicular projection of the point on every edge
float projection_edge1;
float projection_edge2;
float projection_edge3;
float projection_edge4;
// Calculate projection position on every edge
if (b1 == 0) {
projection_edge1 = a1;
} else {
projection_edge1 = ((a1*location.x) - b1);
}
if (b2 == 0) {
projection_edge2 = a2;
} else {
projection_edge2 = ((location.y + b2)/a2);
}
if (b3 == 0) {
projection_edge3 = a3;
} else {
projection_edge3 = ((a3*location.x) - b3);
}
if (b4 == 0) {
projection_edge4 = a4;
} else {
projection_edge4 = ((location.y + b4)/a4);
}
// Check if location is within bounds
if ((location.y > projection_edge1) && (location.y < projection_edge3)) {
if ((location.x < projection_edge2) && (location.x > projection_edge4)) {
return true;
} else {
return false;
}
} else {
return false;
}
}
/*--------------------
* Getters
* -----------------*/
const Vector2 Boundary::getUpperLeft() const {
return this->upper_left;
}
const Vector2 Boundary::getUpperRight() const {
return this->upper_right;
}
const Vector2 Boundary::getLowerLeft() const {
return this->lower_left;
}
const Vector2 Boundary::getLowerRight() const {
return this->lower_right;
}
const Boundary Boundary::createReorientedTopLeftBoundary() const {
Vector2 origin(0, 0);
// Calculate distance to origin for each corner
float distance_upper_left = origin.distance(upper_left );
float distance_upper_right = origin.distance(upper_right);
float distance_lower_left = origin.distance(lower_left );
float distance_lower_right = origin.distance(lower_right);
// Find corner closest to origin
float minimum_distance = std::min(
std::min(
distance_upper_left,
distance_upper_right
),
std::min(
distance_lower_left,
distance_lower_right
)
);
Boundary reoriented_boundary;
// Rotate corners accordingly
if (minimum_distance == distance_upper_left) {
reoriented_boundary = Boundary(
upper_left,
upper_right,
lower_left,
lower_right
);
} else if (minimum_distance == distance_upper_right) {
reoriented_boundary = Boundary(
upper_right,
lower_right,
upper_left,
lower_left
);
} else if (minimum_distance == distance_lower_left) {
reoriented_boundary = Boundary(
lower_left,
upper_left,
lower_right,
upper_right
);
} else {
reoriented_boundary = Boundary(
lower_right,
lower_left,
upper_right,
upper_left
);
}
return reoriented_boundary;
}
|
; A287580: Positions of 3 in A287576.
; 2,7,12,13,17,22,27,32,36,37,42,47,51,56,57,62,67,72,73,78,82,87,92,93,97,102,107,112,116,117,122,127,132,133,138,143,147,152,153,158,162,167,172,173,177,182,187,192,193,198,203,208,212,213,218,223,227,232,233,238,242,247,252,253,257,262,267,272,276,277,282,287,291,296,297,302,306,311,316,317,322,327,332,333,337,342,347,352,356,357,362,367,371,376,377,382,387,392,393,398,402,407,412,413,417,422,427,432,436,437,442,447,452,453,458,463,467,472,473,478,482,487,492,493,497,502,507,512,516,517,522,527,531,536,537,542,546,551,556,557,561,566,571,576,577,582,587,592,596,597,602,607,611,616,617,622,626,631,636,637,642,647,652,653,657,662,667,672,676,677,682,687,691,696,697,702,707,712,713,718,722,727,732,733,737,742,747,752,756,757,762,767,771,776,777,782,786,791,796,797,801,806,811,816,820,821,826,831,836,837,842,847,851,856,857,862,866,871,876,877,881,886,891,896,897,902,907,912,916,917,922,927,931,936,937,942,946,951,956,957,962,967,972,973,977,982,987,992,996,997
add $0,256
cal $0,287577 ; Positions of 0 in A287576.
mov $1,$0
sub $1,1024
|
<% from pwnlib.shellcraft import amd64 %>
<%page args="string, sock = 'rbp'"/>
<%docstring>Writes a string to a file descriptor</%docstring>
${amd64.pushstr(string, append_null = False)}
${amd64.linux.syscall('SYS_write', sock, 'rsp', len(string))}
|
; A294645: a(n) = Sum_{d|n} d^(n+1).
; 1,9,82,1057,15626,282252,5764802,134480385,3486843451,100048830174,3138428376722,107006334784468,3937376385699290,155572843119354936,6568408508343827972,295150156996346511361,14063084452067724991010,708236696816416252145973,37589973457545958193355602,2097153000000481235206811382,122694327390015454028967660500,7511414197443073517963608553988,480250763996501976790165756943042,32009659598406792790745819269966500,2220446049250313082337379455566406251,160059110277919382593205548057734524022
add $0,1
mov $2,$0
lpb $0
mov $3,$2
dif $3,$0
cmp $3,$2
cmp $3,0
mul $3,$0
sub $0,1
pow $3,$2
add $1,$3
add $4,$1
lpe
mov $0,$4
add $0,1
|
;/*!
; @file
;
; @brief BvsGetMode DOS wrapper
;
; (c) osFree Project 2008-2022, <http://www.osFree.org>
; for licence see licence.txt in root directory, or project website
;
; This is Family API implementation for DOS, used with BIND tools
; to link required API
;
; @author Yuri Prokushev (yuri.prokushev@gmail.com)
;
; * 0 NO_ERROR
; * 436 ERROR_VIO_INVALID_HANDLE
; * 438 ERROR_VIO_INVALID_LENGTH
; * 465 ERROR_VIO_DETACHED
; * 494 ERROR_VIO_EXTENDED_SG
;
;BIOS MODE TYPE COLOR COLS ROWS HRES VRES VALID ADAPTER/DISPLAY COMBINATIONS [EMULATED]
;0 5 4 40 25 320 200 [CGA/CD], CGA/Comp, [EGA/CD], [EGA/ECD], VGA/Mono, VGA/Color, VGA/Plasma
;0* 5 4 40 25 320 350 [EGA/ECD], VGA/Mono, VGA/Color, VGA/Plasma
;0+ 5 4 40 25 360 400 VGA/Mono, VGA/Color
;0# 5 4 40 25 320 400 VGA/Mono, VGA/Color, VGA/Plasma
;1 1 4 40 25 320 200 CGA/CD, CGA/Comp, EGA/CD, EGA/ECD, [VGA/Mono], VGA/Color, [VGA/Plasma]
;1* 1 4 40 25 320 350 EGA/ECD, [VGA/Mono], VGA/Color, [VGA/Plasma]
;1+ 1 4 40 25 360 400 [VGA/Mono], VGA/Color
;1# 1 4 40 25 320 400 [VGA/Mono], VGA/Color, [VGA/Plasma]
;2 5 4 80 25 640 200 [CGA/CD], CGA/Comp, [EGA/CD], [EGA/ECD], VGA/Mono, VGA/Color, VGA/Plasma
;2* 5 4 80 25 640 350 [EGA/ECD], VGA/Mono, VGA/Color, VGA/Plasma
;2+ 5 4 80 25 720 400 VGA/Mono, VGA/Color
;2# 5 4 80 25 640 400 VGA/Mono, VGA/Color, VGA/Plasma
;3 1 4 80 25 640 200 CGA/CD, CGA/Comp, EGA/CD, EGA/ECD, [VGA/Mono], VGA/Color, [VGA/Plasma]
;3* 1 4 80 25 640 350 EGA/ECD, [VGA/Mono], VGA/Color, [VGA/Plasma]
;3+ 1 4 80 25 720 400 [VGA/Mono], VGA/Color
;3# 1 4 80 25 640 400 [VGA/Mono], VGA/Color, [VGA/Plasma]
;7 0 0 80 25 720 350 MPA/MD, EGA/MD, VGA/Mono, VGA/Color
;7+ 0 0 80 25 720 400 VGA/Mono, VGA/Color
;7# 0 0 80 25 640 400 VGA/Mono, VGA/Color, VGA/Plasma
;n/a 0 0 80 25 640 350 VGA/Mono, VGA/Color, VGA/Plasma
;n/a 1 4 80 30 720 480 [VGA/Mono], VGA/Color
;n/a 1 4 80 30 640 480 [VGA/Mono], VGA/Color, [VGA/Plasma]
;4 3 2 [40] [25] 320 200 CGA/CD, CGA/Comp, EGA/CD, EGA/ECD, [VGA/Mono], VGA/Color,[VGA/Plasma]
;5 7 2 [40] [25] 320 200 [CGA/CD], CGA/Comp, [EGA/CD], [EGA/ECD], VGA/Mono, VGA/Color, VGA/Plasma
;6 3 1 [80] [25] 640 200 CGA/CD, CGA/Comp, EGA/CD, EGA/ECD, VGA/Mono, VGA/Color, VGA/Plasma
;D 3 4 [40] [25] 320 200 EGA/CD, EGA/ECD, [VGA/Mono], VGA/Color, [VGA/Plasma]
;E 3 4 [80] [25] 640 200 EGA/CD, EGA/ECD, [VGA/Mono], VGA/Color, [VGA/Plasma]
;F 2 0 [80] [25] 640 350 EGA/MD, VGA/Mono, VGA/Color, VGA/Plasma
;10 3 4 [80] [25] 640 350 EGA/ECD, [VGA/Mono], VGA/Color, [VGA/Plasma]
;11 3 1 [80] [30] 640 480 VGA/Mono, VGA/Color, VGA/Plasma
;12 3 4 [80] [30] 640 480 [VGA/Mono], VGA/Color, [VGA/Plasma]
;13 3 8 [40] [25] 320 200 [VGA/Mono], VGA/Color, [VGA/Plasma]
;n/a 11 8 [80] [30] 640 480 [8514A/Mono], 8514A/Color
;n/a 11 4 [80] [30] 640 480 [8514A/Mono], 8514A/Color
;n/a 11 8 [85] [38] 1024 768 [8514A/HMono], 8514A/HColor
;n/a 11 4 [85] [38] 1024 768 [8514A/HMono], 8514A/HColor
;
;*/
.8086
; Helpers
INCLUDE HELPERS.INC
INCLUDE BIOS.INC
INCL_SUB EQU 1
INCLUDE BSEERR.INC
INCLUDE BSESUB.INC
_TEXT SEGMENT BYTE PUBLIC 'CODE' USE16
@BVSPROLOG BVSGETMODE
VIOHANDLE DW ? ;Video handle
MODEINFO DD ? ;
@BVSSTART BVSGETMODE
EXTERN VIOCHECKHANDLE: PROC
MOV BX,[DS:BP].ARGS.VIOHANDLE ; GET HANDLE
CALL VIOCHECKHANDLE
JNZ EXIT
LDS SI, [DS:BP].ARGS.MODEINFO
MOV CX, [DS:SI].VIOMODEINFO.VIOMI_CB
CMP CX, 2
MOV AX, ERROR_VIO_INVALID_LENGTH
JBE EXIT
@GetMode
MOV BX, AX
; Frame buffer type
MOV AL,1
MOV [DS:SI].VIOMODEINFO.VIOMI_FBTYPE, AL ; TYPE: 1=TEXT MODE/3=GRAPH MODE
CMP CX, 3
JBE OK_EXIT
; Number of Colors
MOV AL,4
MOV [DS:SI].VIOMODEINFO.VIOMI_COLOR, AL ; COLOR: 16 COLORS
CMP CX, 4
JBE OK_EXIT
; Number of Columns
MOV AL, BH
XOR AH, AH
MOV [DS:SI].VIOMODEINFO.VIOMI_COL, AX ; Columns
CMP CX, 6
JBE OK_EXIT
; Number of Rows
MOV AX, 40H
MOV ES, AX
MOV AX, [ES:84H] ; Number of rows for EGA and higher
CMP AX, 0
JZ OK_ROWS
MOV AX, 24
OK_ROWS:
INC AX
MOV [DS:SI].VIOMODEINFO.VIOMI_ROW, AX ; Rows
CMP CX, 8
JBE OK_EXIT
; Hres
; Vres
; fmt_id
; attrib
; buf_addr
; buf_length
; full_length
; partail_length
; ext_data_addr
OK_EXIT:
XOR AX,AX
EXIT:
@BVSEPILOG BVSGETMODE
_TEXT ENDS
END
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.