]> git.sur5r.net Git - cc65/blob - libsrc/common/ispunct.s
Avoid unintended file "shadowing".
[cc65] / libsrc / common / ispunct.s
1 ;
2 ; 1998-06-02, Ullrich von Bassewitz
3 ; 2014-09-10, Greg King
4 ;
5 ; int ispunct (int c);
6 ;
7
8         .export         _ispunct
9         .include        "ctype.inc"
10
11 _ispunct:
12         cpx     #>$0000         ; Char range OK?
13         bne     @L1             ; Jump if no
14         tay
15         lda     __ctype,y       ; Get character classification
16         and     #CT_NOT_PUNCT   ; Mask relevant bits
17         cmp     #1              ; If false, then set "borrow" flag
18         lda     #0
19         sbc     #0              ; Invert logic
20         rts                     ; Return NOT (space | control | digit | alpha)
21
22 @L1:    lda     #<0             ; Return false
23         tax
24         rts
25