From 6006cefc70bc69773b5b36382a74ab9042ac65e6 Mon Sep 17 00:00:00 2001 From: Kelvin Sherlock Date: Sun, 4 Mar 2018 22:28:30 -0500 Subject: [PATCH] add the c99 isblank() function --- ctype.asm | 30 ++++++++++++++++++++++++++++-- equates.asm | 1 + 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/ctype.asm b/ctype.asm index 54a6592..4ba2ece 100644 --- a/ctype.asm +++ b/ctype.asm @@ -101,6 +101,32 @@ yes lda #1 rtl end +**************************************************************** +* +* int isblank (int c) +* +* Inputs: +* 4,S - digit to test +* +* Outputs: +* A - result +* +**************************************************************** +* +isblank start + + lda 4,S fetch the operand + tax + lda 2,S remove parm from stack + sta 4,S + pla + sta 1,S + inx form the result + lda >__ctype2,X + and #_blank + rtl + end + **************************************************************** * * int iscntrl (int c) @@ -844,7 +870,7 @@ __ctype2 start dc i1'0' $06 dc i1'0' $07 dc i1'0' $08 - dc i1'0' $09 + dc i1'_blank' $09 dc i1'0' $0A dc i1'0' $0B dc i1'0' $0C @@ -867,7 +893,7 @@ __ctype2 start dc i1'0' $1D dc i1'0' $1E dc i1'0' $1F - dc i1'0' ' ' + dc i1'_blank' ' ' dc i1'0' ! dc i1'0' " dc i1'0' # diff --git a/equates.asm b/equates.asm index 8bf529c..b5a0614 100644 --- a/equates.asm +++ b/equates.asm @@ -36,6 +36,7 @@ _print gequ $80 [' '..'~'] _csym gequ $01 ['0'..'9','A'..'Z','a'..'z','_'] _csymf gequ $02 ['A'..'Z','a'..'z'.'_'] _octal gequ $04 ['0'..'7'] +_blank gequ $08 ['\t', ' '] ; ; signal numbers ;