Mercurial > hg > index.cgi
changeset 39:e956d8b6e806
Add raw version of nextchar/curchar that does not skip spaces
There are a few cases where fetching the next character without skipping
spaces but with the usual flag setting is useful. Notably for parsing line
numbers and other non-keyword syntactic units.
author | William Astle <lost@l-w.ca> |
---|---|
date | Mon, 21 Nov 2022 23:18:40 -0700 |
parents | ef961e1c30cb |
children | 68253ccbb9dc |
files | src/lwbasic.s |
diffstat | 1 files changed, 12 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lwbasic.s Mon Nov 21 22:56:24 2022 -0700 +++ b/src/lwbasic.s Mon Nov 21 23:18:40 2022 -0700 @@ -1004,6 +1004,18 @@ suba #-'0 curchar0 rts ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; This is exactly the same as nextchar except it doesn't skip spaces. Unfortunately, for efficiency purposes, we need +; to actually duplicate code here. +nextcharraw inc inputptr+1 ; bump LSB of input pointer + bne curchar ; brif no carry + inc inputptr ; bump MSB +curcharraw lda [inputptr] ; fetch the byte + cmpa #'9+1 ; clear C if above digits, set Z if colon + bhs curcharraw0 ; brif above digits + suba #'0 ; clever way to set C if >= ASCII 0, Z if zero + suba #-'0 +curcharraw0 rts +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; The error handler ; ; Enter with the error number in B. This routine will do some cleanup and handle any ON ERROR GOTO handler that