diff options
author | Iru Cai <mytbk920423@gmail.com> | 2018-09-28 23:28:19 +0800 |
---|---|---|
committer | Iru Cai <mytbk920423@gmail.com> | 2018-09-29 00:25:45 +0800 |
commit | cdfec28498aecbaaeac5d2ecba9cc21b1fd5b821 (patch) | |
tree | 061f9ab8ce071f24c9738a936d5031acb9f981fe | |
parent | 96c300d7755ce73c34d75d22faefcdd418fd5a46 (diff) | |
download | rich4-cdfec28498aecbaaeac5d2ecba9cc21b1fd5b821.tar.xz |
remove asm 45511b
-rw-r--r-- | csrc/mkf_asm.asm | 80 | ||||
-rw-r--r-- | csrc/mkf_asm_data.c | 62 |
2 files changed, 94 insertions, 48 deletions
diff --git a/csrc/mkf_asm.asm b/csrc/mkf_asm.asm index f9a562c..50019ac 100644 --- a/csrc/mkf_asm.asm +++ b/csrc/mkf_asm.asm @@ -3,7 +3,8 @@ global fcn_00455040 extern table_483430 extern table_483530 extern data_483630 -extern data_4847bc +extern gtables +extern cfcn_45511b fcn_00455040: push ebp @@ -12,15 +13,19 @@ push ebx push ecx push esi push edi +sub esp, 4 mov esi, data_483630 -mov edi, data_4847bc +mov edi, gtables mov ecx, 0x463 ; 1123 rep movsd mov edi, dword [ebp + 8] ; [0x8:4]=-1 ; 8 mov esi, dword [ebp + 0xc] ; [0xc:4]=-1 ; 12 xor edx, edx + L0: + call fcn_004551bb + or bh, bh jne L1 mov byte [edi], bl @@ -59,6 +64,7 @@ pop esi mov ecx, ebp jmp L0 L2: +add esp, 4 pop edi pop esi pop ecx @@ -70,7 +76,7 @@ ret fcn_004551bb: mov ebx, 0x500 ; 1280 L11: -mov bx, word [ebx + data_4847bc + 1284] ; [0x484cc0:2]=0 +mov bx, word [ebx + gtables + 1284] ; [0x484cc0:2]=0 cmp bx, 0x502 ; 1282 jae L10 bt dword [esi], ecx @@ -83,75 +89,55 @@ sub ebx, 0x502 push ebx push ecx push edi + call fcn_00455109 + pop edi pop ecx pop ebx shr bx, 1 + ret fcn_00455109: -cmp word [data_4847bc + 1280], 0x8000 -jne L20 +cmp word [gtables + 1280], 0x8000 +jne L20_1 + push ebx call fcn_004550cc pop ebx -L20: -mov bx, word [ebx + data_4847bc + 3848] -L21: -inc word [ebx + data_4847bc] -mov ax, word [ebx + data_4847bc] -cmp ax, word [ebx + data_4847bc + 2] -jbe L22 -lea edi, [ebx + data_4847bc + 2] -mov ecx, 0x282 -dec ax -repe scasw -sub edi, data_4847bc+4 -inc ax -xchg word [edi + data_4847bc], ax -mov word [ebx + data_4847bc], ax -mov ax, word [ebx + data_4847bc + 1284] -mov cx, word [edi + data_4847bc + 1284] -mov word [ecx + data_4847bc + 2566], bx -cmp cx, 0x502 -jae L24 -mov word [ecx + data_4847bc + 2568], bx -L24: -xchg ax, cx -mov word [ecx + data_4847bc + 2566], di -cmp cx, 0x502 -jae L23 -mov word [ecx + data_4847bc + 2568], di -L23: -mov word [ebx + data_4847bc + 1284], ax -mov word [edi + data_4847bc + 1284], cx -mov bx, di -L22: -mov bx, word [ebx + data_4847bc + 2566] -or bx, bx -jne L21 + +L20_1: + +push ebx +call cfcn_45511b +add esp, 4 + ret fcn_004550cc: -mov edx, 0x141 ; 321 + +mov edx, 0x141 xor ebp, ebp xor ecx, ecx L30: -mov cx, word [ebp + data_4847bc + 3848] -test word [ecx + data_4847bc], 1 +mov cx, word [ebp + gtables + 3848] +test word [ecx + gtables], 1 je L31 -mov ebx, ebp -call L20 + +push ebp +call cfcn_45511b +add esp, 4 + L31: add ebp, 2 dec edx jne L30 xor ebx, ebx L32: -shr word [ebx + data_4847bc], 1 +shr word [ebx + gtables], 1 add ebx, 2 cmp ebx, 0x502 ; 1282 jb L32 -ret +ret diff --git a/csrc/mkf_asm_data.c b/csrc/mkf_asm_data.c index 7390d39..b01dd42 100644 --- a/csrc/mkf_asm_data.c +++ b/csrc/mkf_asm_data.c @@ -511,4 +511,64 @@ const uint8_t data_483630[4492] = { 0x00, 0x00 }; -uint8_t data_4847bc[4492]; +struct { + uint16_t tab1[642]; /* 0x4847bc, from 0x483630 */ + uint16_t tab2[641]; /* 0x484cc0, from 0x483b34 */ + uint16_t tab3[641]; /* 0x4851c2, from 0x484036 */ + uint16_t tab4[322]; /* 0x4856c4, from 0x484538 */ +} gtables; /* 0x4847bc */ + +void cfcn_45511b(uint32_t ebx) +{ + uint16_t ax, cx, tmp; + ebx = gtables.tab4[ebx / 2]; + do { + gtables.tab1[ebx / 2]++; + ax = gtables.tab1[ebx / 2]; + if (ax <= gtables.tab1[ebx / 2 + 1]) { + ebx = gtables.tab3[ebx / 2]; + if (ebx) + continue; + else + break; + } + + uint16_t *edi = >ables.tab1[ebx / 2 + 1]; + cx = 0x282; + ax --; + int zf; + do { + zf = (*edi == ax); + edi++; + cx--; + } while (zf && cx); + + uint32_t _edi = (uint32_t)edi - (uint32_t)(>ables.tab1[2]); + ax++; + + tmp = ax; + ax = gtables.tab1[_edi / 2]; + gtables.tab1[_edi / 2] = tmp; + gtables.tab1[ebx / 2] = ax; + + ax = gtables.tab2[ebx / 2]; + cx = gtables.tab2[_edi / 2]; + gtables.tab3[cx / 2] = ebx; + if (cx < 0x502) { + gtables.tab3[cx / 2 + 1] = ebx; + } + + tmp = ax; + ax = cx; + cx = tmp; + + gtables.tab3[cx / 2] = _edi; + if (cx < 0x502) { + gtables.tab3[cx / 2 + 1] = _edi; + } + gtables.tab2[ebx / 2] = ax; + gtables.tab2[_edi / 2] = cx; + ebx = _edi & 0xffff; + ebx = gtables.tab3[ebx / 2]; + } while (ebx); +} |