]> git.sur5r.net Git - cc65/blob - libsrc/common/ispunct.s
Another small improvement
[cc65] / libsrc / common / ispunct.s
1 ;
2 ; Ullrich von Bassewitz, 02.06.1998
3 ;
4 ; int ispunct (int c);
5 ;
6
7         .export         _ispunct
8         .include        "ctype.inc"
9
10 _ispunct:
11         cpx     #$00            ; Char range ok?
12         bne     @L1             ; Jump if no
13         tay
14         lda     __ctype,y       ; Get character classification
15         eor     #CT_NOT_PUNCT   ; NOT (space | control | digit | alpha)
16         and     #CT_NOT_PUNCT   ; Mask relevant bits
17         rts
18
19 @L1:    lda     #$00            ; Return false
20         tax
21         rts
22