home *** CD-ROM | disk | FTP | other *** search
- TITLE UDF3.ASM - Assembly Language functions for CLIPPER
- ; by Gregory A. Martin
- ; These functions may be freely used, but may not be published.
-
- INCLUDE EXTENDA.INC
-
- PUSH_ALL macro
- $gen < push ds>
- $gen < push es>
- $gen < push si>
- $gen < push di>
- endm
-
- POP_ALL macro
- $gen < pop di>
- $gen < pop si>
- $gen < pop es>
- $gen < pop ds>
- endm
-
-
- CLpublic <INCOUNT>
-
-
- ;----------------------------------
- ; InCount
- ;-----------------------------------
- CLfunc long INCOUNT <char string, char character>
- CLcode
- PUSH_ALL
-
- Ccall _parclen <1, 0> ; get character length
- cmp ax, 0 ; null string?
- je InCount_End
-
- lds si, character
- mov bl, [si]
- lds si, string ; load ptr to string
- mov cx, ax ; move count to cx
- mov ax, 0 ; load long int with 0
- InCount_For: cmp byte ptr [si], bl ; compare char to return
- jne InCount_Skip
- inc ax ; increment count
- InCount_Skip: inc si ; increment pointer
- jz InCount_Inc ; increment dataseg if needed
- InCount_Next: loop InCount_For
- jmp InCount_End
-
- InCount_Inc: mov bx, ds
- add bx, 4096 ; add 64K to ds seg
- mov ds, bx
- jmp InCount_Next
-
- InCount_End: POP_ALL
- mov bx, 0
- CLret bx ax
-
-
- END