changed mixed case patch

better tokenize - source: jbevren @ forum.6502.org
This commit is contained in:
Klaus2m5 2018-01-20 14:19:53 +01:00
parent 229c744455
commit 0a70ad5bd0
1 changed files with 10 additions and 11 deletions

View File

@ -1,7 +1,7 @@
Tokenizer mixed case keyword recognition Tokenizer mixed case keyword recognition
This modification is based on a patch by user ArnoldLayne of the 6502.org This modification is based on a patch by user ArnoldLayne and jbevren of the
forum: http://forum.6502.org/viewtopic.php?f=5&t=4383 6502.org forum: http://forum.6502.org/viewtopic.php?f=5&t=4383
In EhBasic keywords must be upper case. This may be inconvenient on computers In EhBasic keywords must be upper case. This may be inconvenient on computers
with mixed case support. The modification below changes the tokenizer to match with mixed case support. The modification below changes the tokenizer to match
@ -25,7 +25,7 @@ LAB_13AC
LDA Ibuffs,X ; get byte from input buffer LDA Ibuffs,X ; get byte from input buffer
BEQ LAB_13EC ; if null save byte then exit BEQ LAB_13EC ; if null save byte then exit
; *** begin patch: lower case token recognition *** ; *** begin patch: lower case token recognition V2 ***
; *** WARNING! changes documented behavior! ; *** WARNING! changes documented behavior!
; *** add ; *** add
CMP #'{' ; convert lower to upper case CMP #'{' ; convert lower to upper case
@ -103,15 +103,14 @@ LAB_13D8
BMI LAB_13EA ; all bytes matched so go save token BMI LAB_13EA ; all bytes matched so go save token
INX ; next buffer byte INX ; next buffer byte
CMP Ibuffs,X ; compare with byte from input buffer ; *** replace
; CMP Ibuffs,X ; compare with byte from input buffer
; *** with
EOR Ibuffs,x ; check bits against table
AND #$DF ; DF masks the upper/lower case bit
; *** end
BEQ LAB_13D6 ; go compare next if match BEQ LAB_13D6 ; go compare next if match
;*** add
ORA #$20 ; repeat with lower case
CMP Ibuffs,X ; compare with byte from input buffer
BEQ LAB_13D6 ; go compare next if match
; *** end
BNE LAB_1417 ; branch if >< (not found keyword) BNE LAB_1417 ; branch if >< (not found keyword)
LAB_13EA LAB_13EA
@ -177,7 +176,7 @@ LAB_141B
; *** add label ; *** add label
PATCH_LC2 PATCH_LC2
; *** end ; *** end
; *** end patch: lower case token recognition *** ; *** end patch: lower case token recognition V2 ***
LDA Ibuffs,X ; restore byte from input buffer LDA Ibuffs,X ; restore byte from input buffer
BPL LAB_13EA ; branch always (all bytes in buffer are $00-$7F) BPL LAB_13EA ; branch always (all bytes in buffer are $00-$7F)