|
- .版本 2
- .支持库 spec
- .程序集 程序集1
- .子程序 _启动子程序, 整数型, , 请在本子程序中放置易模块初始化代码
- _临时子程序 () ' 在初始化代码执行完毕后调用测试代码
- 返回 (0) ' 可以根据您的需要返回任意数值
- .子程序 _临时子程序
- .局部变量 成功, 逻辑型
- ' 本名称子程序用作测试程序用,仅在开发及调试环境中有效,编译发布程序前将被系统自动清空,请将所有用作测试的临时代码放在本子程序中。 ***注意不要修改本子程序的名称、参数及返回值类型。
- 输出调试文本 (文本IPv4地址到整数型 (“1.2.3.4”, 成功))
- 调试输出 (成功)
- 输出调试文本 (文本IPv4地址到整数型 (“127.0.0.1”, 成功))
- 调试输出 (成功)
- 输出调试文本 (文本IPv4地址到整数型 (“192.168.1.1”, 成功))
- 调试输出 (成功)
- 输出调试文本 (文本IPv4地址到整数型 (“192.384.255.0”, 成功))
- 调试输出 (成功)
- 输出调试文本 (文本IPv4地址到整数型 (“13..13.13”, 成功))
- 调试输出 (成功)
- 输出调试文本 (文本IPv4地址到整数型 (“123.123.123.123”, 成功))
- 调试输出 (成功)
- .子程序 文本IPv4地址到整数型, 整数型, 公开, 功能与PHP的 ip2long() 函数相同
- .参数 IPv4地址, 文本型, , 提供IP地址文本
- .参数 转换成功, 逻辑型, 参考, 操作成功传出真,失败假并返回0
- 置入代码 ({ 83, 81, 82, 86, 87, 50, 237, 51, 219, 139, 69, 8, 139, 117, 12, 139, 0, 232, 187, 0, 0, 0, 131, 250, 7, 114, 5, 131, 250, 15, 118, 9, 51, 192, 136, 46, 233, 159, 0, 0, 0, 232, 187, 0, 0, 0, 131, 250, 3, 116, 9, 51, 192, 136, 46, 233, 140, 0, 0, 0, 232, 194, 0, 0, 0, 10, 210, 117, 6, 51, 192, 136, 46, 235, 125, 232, 34, 1, 0, 0, 10, 210, 116, 6, 51, 192, 136, 46, 235, 110, 232, 56, 1, 0, 0, 10, 210, 117, 6, 51, 192, 136, 46, 235, 95, 50, 201, 235, 80, 232, 184, 0, 0, 0, 102, 129, 250, 255, 0, 118, 6, 51, 192, 136, 46, 235, 73, 193, 227, 8, 10, 218, 128, 249, 3, 115, 50, 102, 131, 250, 0, 114, 11, 102, 131, 250, 9, 119, 5, 131, 192, 2, 235, 33, 102, 131, 250, 10, 114, 11, 102, 131, 250, 99, 119, 5, 131, 192, 3, 235, 16, 102, 131, 250, 100, 114, 10, 102, 129, 250, 255, 0, 119, 3, 131, 192, 4, 254, 193, 128, 249, 4, 114, 171, 181, 1, 136, 46, 139, 195, 95, 94, 90, 89, 91, 201, 194, 8, 0, 80, 83, 139, 208, 138, 24, 10, 219, 117, 2, 235, 3, 64, 235, 245, 139, 216, 135, 218, 43, 211, 91, 88, 195, 80, 83, 51, 210, 138, 24, 10, 219, 117, 4, 235, 11, 235, 6, 128, 251, 46, 117, 1, 66, 64, 235, 237, 91, 88, 195, 80, 83, 138, 24, 10, 219, 117, 6, 178, 1, 235, 24, 235, 19, 128, 251, 48, 114, 5, 128, 251, 57, 118, 9, 128, 251, 46, 116, 4, 50, 210, 235, 3, 64, 235, 222, 91, 88, 195, 83, 81, 86, 51, 210, 51, 219, 51, 201, 190, 10, 0, 0, 0, 235, 48, 138, 28, 1, 128, 251, 48, 114, 5, 128, 251, 57, 118, 4, 235, 37, 235, 30, 128, 251, 48, 117, 7, 10, 255, 117, 3, 70, 235, 18, 183, 1, 128, 235, 48, 107, 210, 10, 83, 129, 227, 255, 0, 0, 0, 3, 211, 91, 65, 59, 206, 114, 204, 94, 89, 91, 195, 80, 83, 138, 24, 10, 219, 117, 6, 50, 210, 235, 22, 235, 17, 128, 251, 46, 117, 12, 138, 88, 1, 128, 251, 46, 117, 4, 178, 1, 235, 3, 64, 235, 224, 91, 88, 195, 80, 83, 138, 24, 10, 219, 117, 6, 178, 1, 235, 40, 235, 35, 128, 251, 46, 117, 30, 138, 88, 255, 138, 120, 1, 128, 251, 48, 114, 15, 128, 251, 57, 119, 10, 128, 255, 48, 114, 5, 128, 255, 57, 118, 4, 50, 210, 235, 3, 64, 235, 206, 91, 88, 195 })
- ' push ebx
- ' push ecx
- ' push edx
- ' push esi
- ' push edi
- ' xor ch,ch
- ' xor ebx,ebx
- ' mov eax,[ebp+8]
- ' mov esi,[ebp+12]
- ' mov eax,[eax]
- ' call TEXT_LEN ;
- ' .if edx < 7 || edx > 15
- ' xor eax,eax
- ' mov [esi],ch
- ' jmp ASM_END
- ' .endif
- ' call TEXT_POINT_NUM
- ' .if edx != 3
- ' xor eax,eax
- ' mov [esi],ch
- ' jmp ASM_END
- ' .endif
- ' call IS_TEXT_NUM_POINT
- ' .if !dl
- ' xor eax,eax
- ' mov [esi],ch
- ' jmp ASM_END
- ' .endif
- ' call IS_TEXT_POINT2
- ' .if dl
- ' xor eax,eax
- ' mov [esi],ch
- ' jmp ASM_END
- ' .endif
- ' call IS_TEXT_POINT_LR_NUM
- ' .if !dl
- ' xor eax,eax
- ' mov [esi],ch
- ' jmp ASM_END
- ' .endif
- ' xor cl,cl
- ' .while cl < 4
- ' call TEXT2INT
- ' .if dx > 255
- ' xor eax,eax
- ' mov [esi],ch
- ' jmp ASM_END
- ' .endif
- ' shl ebx,8
- ' or bl,dl
- ' .if cl < 3
- ' .if dx >= 0 && dx <= 9
- ' add eax,2
- ' .elseif dx >= 10 && dx <= 99
- ' add eax,3
- ' .elseif dx >= 100 && dx <= 255
- ' add eax,4
- ' .endif
- ' .endif
- ' inc cl
- ' .endw
- ' mov ch,1
- ' mov [esi],ch
- ' mov eax,ebx
- ' ASM_END:
- ' pop edi
- ' pop esi
- ' pop edx
- ' pop ecx
- ' pop ebx
- ' leave
- ' retn 8
- ' TEXT_LEN: ;EAX:文本指针 EDX(返回):文本长度
- ' push eax
- ' push ebx
- ' mov edx,eax
- ' .while 1
- ' mov bl,[eax]
- ' .if !bl
- ' .break
- ' .endif
- ' inc eax
- ' .endw
- ' mov ebx,eax
- ' xchg ebx,edx
- ' sub edx,ebx
- ' pop ebx
- ' pop eax
- ' ret
- ' TEXT_POINT_NUM: ;EAX:文本指针 EDX:返回小数点的数量
- ' push eax
- ' push ebx
- ' xor edx,edx
- ' .while 1
- ' mov bl,[eax]
- ' .if !bl
- ' .break
- ' .elseif bl == 46
- ' inc edx
- ' .endif
- ' inc eax
- ' .endw
- ' pop ebx
- ' pop eax
- ' ret
- ' IS_TEXT_NUM_POINT: ;EAX:文本指针 DL:返回1或0 是否只包含数字0~9和小数点
- ' push eax
- ' push ebx
- ' .while 1
- ' mov bl,[eax]
- ' .if ! bl
- ' mov dl,1
- ' .break
- ' .elseif (bl < 48 || bl > 57) && bl != 46
- ' xor dl,dl
- ' .break
- ' .endif
- ' inc eax
- ' .endw
- ' pop ebx
- ' pop eax
- ' ret
- ' ;文本整数转整数型(不支持负数,遇到其他字符终止转换)
- ' ;EAX:文本指针 EDX:整数输出
- ' TEXT2INT:
- ' push ebx
- ' push ecx
- ' push esi
- ' xor edx,edx
- ' xor ebx,ebx
- ' xor ecx,ecx
- ' mov esi,10
- ' .while ecx < esi
- ' mov bl,[eax+ecx]
- ' .if bl < 48 || bl > 57
- ' .break
- ' .elseif bl == 48 && !bh
- ' inc esi
- ' .else
- ' mov bh,1
- ' sub bl,48
- ' imul edx,10
- ' push ebx
- ' and ebx,255
- ' add edx,ebx
- ' pop ebx
- ' .endif
- ' inc ecx
- ' .endw
- ' pop esi
- ' pop ecx
- ' pop ebx
- ' ret
- ' IS_TEXT_POINT2: ;文本中是否有两个连续的小数点 EAX:文本指针 DL:返回1或0
- ' push eax
- ' push ebx
- ' .while 1
- ' mov bl,[eax]
- ' .if !bl
- ' xor dl,dl
- ' .break
- ' .elseif bl == 46
- ' mov bl,[eax+1]
- ' .if bl == 46
- ' mov dl,1
- ' .break
- ' .endif
- ' .endif
- ' inc eax
- ' .endw
- ' pop ebx
- ' pop eax
- ' ret
- ' IS_TEXT_POINT_LR_NUM: ;小数点左右是否都是数字 EAX:文本指针 DL:返回1或0
- ' push eax
- ' push ebx
- ' .while 1
- ' mov bl,[eax]
- ' .if !bl
- ' mov dl,1
- ' .break
- ' .elseif bl == 46
- ' mov bl,[eax-1]
- ' mov bh,[eax+1]
- ' .if bl < 48 || bl > 57 || bh < 48 || bh > 57
- ' xor dl,dl
- ' .break
- ' .endif
- ' .endif
- ' inc eax
- ' .endw
- ' pop ebx
- ' pop eax
- ' ret
- 返回 (0)
复制代码 |
|