Rev 626 | Rev 629 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 626 | Rev 627 | ||
---|---|---|---|
Line 585... | Line 585... | ||
585 | ;----------------------------------------------------------------------------- |
585 | ;----------------------------------------------------------------------------- |
586 | proc mem.Alloc,size ;///////////////////////////////////////////////////////// |
586 | proc mem.Alloc,size ;///////////////////////////////////////////////////////// |
587 | ;----------------------------------------------------------------------------- |
587 | ;----------------------------------------------------------------------------- |
588 | push ebx ecx |
588 | push ebx ecx |
589 | mov ecx,[size] |
589 | mov ecx,[size] |
590 | add ecx,4+4095 |
590 | add ecx,4 |
591 | and ecx,not 4095 |
- | |
592 | mcall 68,12 |
591 | mcall 68,12 |
593 | add ecx,-4 |
592 | add ecx,-4 |
594 | mov [eax],ecx |
593 | mov [eax],ecx |
595 | add eax,4 |
594 | add eax,4 |
596 | pop ecx ebx |
595 | pop ecx ebx |
597 | ret |
596 | ret |
598 | @^ |
- | |
599 | push ebx ecx |
- | |
600 | mov eax,[size] |
- | |
601 | lea ecx,[eax+4+4095] |
- | |
602 | and ecx,not 4095 |
- | |
603 | mcall 68,12 |
- | |
604 | add ecx,-4 |
- | |
605 | mov [eax],ecx |
- | |
606 | add eax,4 |
- | |
607 | pop ecx ebx |
- | |
608 | ret |
- | |
609 | ^@ |
- | |
610 | endp |
597 | endp |
Line 611... | Line 598... | ||
611 | 598 | ||
612 | ;----------------------------------------------------------------------------- |
599 | ;----------------------------------------------------------------------------- |
613 | proc mem.ReAlloc,mptr,size ;////////////////////////////////////////////////// |
600 | proc mem.ReAlloc,mptr,size ;////////////////////////////////////////////////// |
614 | ;----------------------------------------------------------------------------- |
- | |
615 | @^ |
601 | ;----------------------------------------------------------------------------- |
616 | push ebx ecx edx |
602 | push ebx ecx edx |
617 | mov ecx,[size] |
603 | mov ecx,[size] |
- | 604 | or ecx,ecx |
|
618 | add ecx,4+4095 |
605 | jz @f |
619 | and ecx,not 4095 |
606 | add ecx,4 |
- | 607 | @@: mov edx,[mptr] |
|
- | 608 | or edx,edx |
|
620 | mov edx,[mptr] |
609 | jz @f |
621 | add edx,-4 |
610 | add edx,-4 |
622 | mcall 68,20 |
611 | @@: mcall 68,20 |
623 | add ecx,-4 |
612 | add ecx,-4 |
624 | mov [eax],ecx |
613 | mov [eax],ecx |
625 | add eax,4 |
614 | add eax,4 |
626 | pop edx ecx ebx |
615 | pop edx ecx ebx |
627 | ret |
- | |
628 | ^@ |
- | |
629 | push ebx ecx esi edi eax |
- | |
630 | mov eax,[mptr] |
- | |
631 | mov ebx,[size] |
- | |
632 | or eax,eax |
- | |
633 | jz @f |
- | |
634 | lea ecx,[ebx+4+4095] |
- | |
635 | and ecx,not 4095 |
- | |
636 | add ecx,-4 |
- | |
637 | cmp ecx,[eax-4] |
- | |
638 | je .exit |
- | |
639 | @@: stdcall mem.Alloc,ebx |
- | |
640 | xchg eax,[esp] |
- | |
641 | or eax,eax |
- | |
642 | jz .exit |
- | |
643 | mov esi,eax |
- | |
644 | xchg eax,[esp] |
- | |
645 | mov edi,eax |
- | |
646 | mov ecx,[esi-4] |
- | |
647 | cmp ecx,[edi-4] |
- | |
648 | jbe @f |
- | |
649 | mov ecx,[edi-4] |
- | |
650 | @@: add ecx,3 |
- | |
651 | shr ecx,2 |
- | |
652 | cld |
- | |
653 | rep movsd |
- | |
654 | xchg eax,[esp] |
- | |
655 | stdcall mem.Free,eax |
- | |
656 | .exit: |
- | |
657 | pop eax edi esi ecx ebx |
- | |
658 | ret |
616 | ret |
Line 659... | Line 617... | ||
659 | endp |
617 | endp |
660 | 618 | ||
661 | ;----------------------------------------------------------------------------- |
619 | ;----------------------------------------------------------------------------- |
662 | proc mem.Free,mptr ;////////////////////////////////////////////////////////// |
620 | proc mem.Free,mptr ;////////////////////////////////////////////////////////// |
663 | ;----------------------------------------------------------------------------- |
621 | ;----------------------------------------------------------------------------- |
- | 622 | push ebx ecx |
|
- | 623 | mov ecx,[mptr] |
|
664 | push ebx ecx |
624 | or ecx,ecx |
665 | mov ecx,[mptr] |
625 | jz @f |
666 | add ecx,-4 |
- | |
667 | mcall 68,13 |
- | |
668 | pop ecx ebx |
- | |
669 | ret |
- | |
670 | @^ |
- | |
671 | push ebx ecx |
- | |
672 | mov eax,[mptr] |
- | |
673 | lea ecx,[eax-4] |
626 | add ecx,-4 |
674 | mcall 68,13 |
627 | @@: mcall 68,13 |
675 | pop ecx ebx |
- | |
676 | ret |
628 | pop ecx ebx |