# HG changeset patch # User William Astle # Date 1669097920 25200 # Node ID e956d8b6e8064242126ac3a77047303c7b95be69 # Parent ef961e1c30cbe4cbd6d574f3e760c697eb0ebbbf 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. diff -r ef961e1c30cb -r e956d8b6e806 src/lwbasic.s --- 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