| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Squares |
> les di,somepointer
> mov cx,0
> mov al,0
> repz scasb ;// most of the work is done here.
^^^^
> mov ax,cx
> works line strlen
Are you sure about this? The repe scasb instructions depend for
direction on the direction flag. It can be disastrous, particularly in ISRs
to take it for granted like this (pushf, CLD or STD, ... popf is required
to be certain). Similarly the CX or ECX register must be non-zero for the
instructions to continue till the discarded subtraction of ES:[(E)DI] from
AX resets the zero flag. It decrements CX or ECX so it counts down, not up
(like djnz). It may increment or decrement ES:EDI or ES:DI according to the
direction flag. This looks as if you are looking for the first byte not to
match AX, rather than the first to match it.
You have succeeded in confusing me, Jasen. Well done!
I think I'll stick to size_t strlen(const char *s) till you clarify
things. I know where I am with that.
Best Wishes,
Bill.
---
* Origin: Escan BBS (2:25/200)SEEN-BY: 633/267 270 @PATH: 25/200 108 252/110 250/501 140/1 106/2000 633/267 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.