Rev 233 | Rev 254 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 233 | Rev 237 | ||
---|---|---|---|
Line 1333... | Line 1333... | ||
1333 | ; out dx, al ;bocsh |
1333 | ; out dx, al ;bocsh |
1334 | ; pop edx |
1334 | ; pop edx |
1335 | ; pop eax0>> |
1335 | ; pop eax |
1336 | 1336 | ||
Line -... | Line 1337... | ||
- | 1337 | ||
- | 1338 | align 4 |
|
- | 1339 | k_strrchr: |
|
- | 1340 | push eax |
|
- | 1341 | xor eax,eax |
|
- | 1342 | or ecx,-1 |
|
- | 1343 | repne scasb |
|
- | 1344 | add ecx,1 |
|
- | 1345 | neg ecx |
|
- | 1346 | sub edi,1 |
|
- | 1347 | pop eax |
|
- | 1348 | std |
|
- | 1349 | repne scasb |
|
- | 1350 | cld |
|
- | 1351 | add edi,1 |
|
- | 1352 | ||
- | 1353 | cmp [edi],al |
|
- | 1354 | jne @F |
|
- | 1355 | mov eax,edi |
|
- | 1356 | ret |
|
- | 1357 | @@: |
|
- | 1358 | xor eax,eax |
|
- | 1359 | ret |
|
- | 1360 | ||
- | 1361 | align 4 |
|
- | 1362 | proc k_strncpy stdcall, dest:dword, src:dword, maxlen:dword |
|
- | 1363 | mov eax, [dest] |
|
- | 1364 | mov esi, [src] |
|
- | 1365 | mov ecx, [maxlen] |
|
- | 1366 | test eax, eax |
|
- | 1367 | jz .L9 |
|
- | 1368 | test esi, esi |
|
- | 1369 | jz .L9 |
|
- | 1370 | test ecx, ecx |
|
- | 1371 | jz .L9 |
|
- | 1372 | ||
- | 1373 | sub esi, eax |
|
- | 1374 | jmp .L1 |
|
- | 1375 | ||
- | 1376 | align 4 |
|
- | 1377 | .L2: |
|
- | 1378 | mov edx, [esi+eax] |
|
- | 1379 | mov [eax], dl |
|
- | 1380 | test dl, dl |
|
- | 1381 | jz .L7 |
|
- | 1382 | ||
- | 1383 | mov [eax+1], dh |
|
- | 1384 | test dh, dh |
|
- | 1385 | jz .L6 |
|
- | 1386 | ||
- | 1387 | shr edx, 16 |
|
- | 1388 | mov [eax+2],dl |
|
- | 1389 | test dl, dl |
|
- | 1390 | jz .L5 |
|
- | 1391 | ||
- | 1392 | mov [eax+3], dh |
|
- | 1393 | test dh, dh |
|
- | 1394 | jz .L4 |
|
- | 1395 | add eax, 4 |
|
- | 1396 | .L1: |
|
- | 1397 | sub ecx, 4 |
|
- | 1398 | jae .L2 |
|
- | 1399 | ||
- | 1400 | add ecx, 4 |
|
- | 1401 | jz .L9 |
|
- | 1402 | ||
- | 1403 | mov dl, [eax+esi] |
|
- | 1404 | mov [eax], dl |
|
- | 1405 | test dl, dl |
|
- | 1406 | jz .L3 |
|
- | 1407 | ||
- | 1408 | inc eax |
|
- | 1409 | dec ecx |
|
- | 1410 | jz .L9 |
|
- | 1411 | ||
- | 1412 | mov dl, [eax+esi] |
|
- | 1413 | mov [eax], dl |
|
- | 1414 | test dl, dl |
|
- | 1415 | jz .L3 |
|
- | 1416 | ||
- | 1417 | inc eax |
|
- | 1418 | dec ecx |
|
- | 1419 | jz .L9 |
|
- | 1420 | ||
- | 1421 | mov dl, [eax+esi] |
|
- | 1422 | mov [eax], dl |
|
- | 1423 | test dl, dl |
|
- | 1424 | jz .L3 |
|
- | 1425 | ||
- | 1426 | inc eax |
|
- | 1427 | jmp .L9 |
|
- | 1428 | ||
- | 1429 | .L4: dec ecx |
|
- | 1430 | inc eax |
|
- | 1431 | ||
- | 1432 | .L5: dec ecx |
|
- | 1433 | inc eax |
|
- | 1434 | ||
- | 1435 | .L6: dec ecx |
|
- | 1436 | inc eax |
|
- | 1437 | .L7: |
|
- | 1438 | add ecx,3 |
|
- | 1439 | jz .L9 |
|
- | 1440 | .L8: |
|
- | 1441 | mov byte [ecx+eax], 0 |
|
- | 1442 | .L3: |
|
- | 1443 | dec ecx |
|
- | 1444 | jnz .L8 |
|
- | 1445 | .L9: |
|
- | 1446 | ret |
|
- | 1447 | endp |
|
- | 1448 | ||
- | 1449 | if 0 |
|
- | 1450 | ||
- | 1451 | magic equ 0xfefefeff |
|
- | 1452 | ||
- | 1453 | k_strlen: |
|
- | 1454 | mov eax,[esp+4] |
|
- | 1455 | mov edx, 3 |
|
- | 1456 | ||
- | 1457 | and edx, eax |
|
- | 1458 | jz .L1 |
|
- | 1459 | jp .L0 |
|
- | 1460 | ||
- | 1461 | cmp dh, byte [eax] |
|
- | 1462 | je .L2 |
|
- | 1463 | ||
- | 1464 | inc eax |
|
- | 1465 | cmp dh, byte [eax] |
|
- | 1466 | ||
- | 1467 | je .L2 |
|
- | 1468 | ||
- | 1469 | inc eax |
|
- | 1470 | xor edx, 2 |
|
- | 1471 | ||
- | 1472 | jz .L1 |
|
- | 1473 | .L0: |
|
- | 1474 | cmp dh, [eax] |
|
- | 1475 | je .L2 |
|
- | 1476 | ||
- | 1477 | inc eax |
|
- | 1478 | xor edx, edx |
|
- | 1479 | ||
- | 1480 | .L1: |
|
- | 1481 | mov ecx, [eax] |
|
- | 1482 | add eax, 4 |
|
- | 1483 | ||
- | 1484 | sub edx, ecx |
|
- | 1485 | add ecx, magic |
|
- | 1486 | ||
- | 1487 | dec edx |
|
- | 1488 | jnc .L3 |
|
- | 1489 | ||
- | 1490 | xor edx, ecx |
|
- | 1491 | and edx, not magic |
|
- | 1492 | jne .L3 |
|
- | 1493 | ||
- | 1494 | mov ecx, [eax] |
|
- | 1495 | add eax, 4 |
|
- | 1496 | ||
- | 1497 | sub edx, ecx |
|
- | 1498 | add ecx, magic |
|
- | 1499 | dec edx |
|
- | 1500 | jnc .L3 |
|
- | 1501 | ||
- | 1502 | xor edx, ecx |
|
- | 1503 | and edx, not magic |
|
- | 1504 | jne .L3 |
|
- | 1505 | ||
- | 1506 | mov ecx, [eax] |
|
- | 1507 | add eax, 4 |
|
- | 1508 | ||
- | 1509 | sub edx, ecx |
|
- | 1510 | add ecx, magic |
|
- | 1511 | ||
- | 1512 | dec edx |
|
- | 1513 | jnc .L3 |
|
- | 1514 | ||
- | 1515 | xor edx, ecx |
|
- | 1516 | ||
- | 1517 | and edx, not magic |
|
- | 1518 | jne .L3 |
|
- | 1519 | ||
- | 1520 | mov ecx, [eax] |
|
- | 1521 | add eax, 4 |
|
- | 1522 | ||
- | 1523 | sub edx, ecx |
|
- | 1524 | add ecx, magic |
|
- | 1525 | ||
- | 1526 | dec edx |
|
- | 1527 | jnc .L3 |
|
- | 1528 | ||
- | 1529 | xor edx, ecx |
|
- | 1530 | ||
- | 1531 | and edx, not magic |
|
- | 1532 | je .L1 |
|
- | 1533 | ||
- | 1534 | .L3: sub eax ,4 |
|
- | 1535 | sub ecx, magic |
|
- | 1536 | ||
- | 1537 | cmp cl, 0 |
|
- | 1538 | jz .L2 |
|
- | 1539 | ||
- | 1540 | inc eax |
|
- | 1541 | test ch, ch |
|
- | 1542 | jz .L2 |
|
- | 1543 | ||
- | 1544 | shr ecx, 16 |
|
- | 1545 | inc eax |
|
- | 1546 | ||
- | 1547 | cmp cl,0 |
|
- | 1548 | jz .L2 |
|
- | 1549 | ||
- | 1550 | inc eax |
|
- | 1551 | ||
- | 1552 | .L2: |
|
- | 1553 | sub eax, [esp+4] |
|
- | 1554 | ret |
|
- | 1555 | ||
- | 1556 | end if0>> |