[retroforth] Re: ztype in assembler

  • From: "Ron Aaron" <ron@xxxxxxxxxxx>
  • To: retroforth@xxxxxxxxxxxxx
  • Date: Wed, 26 Jan 2005 13:49:37 -0800 (PST)

On Wed, January 26, 2005 13:30, Helmar Wodtke said:
> retroforth@xxxxxxxxxxxxx schrieb am 26.01.05 22:20:57:
> With a shorter loop:
>
>> ; ----------------------------------------------------------------------
>> code 'ztype',ztype
>>         push ebx                ;
>>         push ecx                ;
>>         upop ebx                ;
>>         lea ecx, byte [ebx - 1]
>> .a:     inc ecx
>>         cmp byte [ecx], 0
>>         jnz .a
>>         sub ecx,ebx
>>         jmp type.a
>> ; next
>
> Ron, expert :) Faster?
>

Dunno.  I have a 'ztc' word which takes a zstr and returns a forth string/count

Zstring ztc type

; ( zstr -- zstr len )
code 'ztc', _ztc
        push eax        ; save ptr
        mov edi, eax
        xor eax, eax
        mov ecx, -1
        repne scasb
        pop eax
        sub edi, eax
        dec edi
        upsh edi
next

I haven't tried to make it smaller or faster yet...

>
>
> -- Binary/unsupported file stripped by Ecartis --
> -- Type: application/x-pkcs7-signature
> -- File: smime.p7s
> -- Desc: S/MIME Cryptographic Signature
>
>
>


-- 
My GPG public key is at http://ronware.org/
fingerprint: 8130 734C 69A3 6542 0853  CB42 3ECF 9259 AD29 415D




Other related posts: