variable support cleanup
This commit is contained in:
1 parent
51aec45c8d
commit
09f85cea8a
64 files changed
+266
-87
No files matched your search
@@ -0,0 +1,106 @@
|
||||
// #LAYOUT# STD * #TAKE
|
||||
// #LAYOUT# * BASIC_0 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Fetches an operator - for the expression parser
|
||||
//
|
||||
// Note: does not recognize unary operators
|
||||
//
|
||||
|
||||
|
||||
fetch_operator: // XXX change the operator code to start from 0
|
||||
|
||||
// Retrieve the next character
|
||||
|
||||
jsr fetch_character
|
||||
|
||||
// Check if within range
|
||||
|
||||
sec
|
||||
sbc #$AA
|
||||
bcc fetch_operator_failed // branch if below 0
|
||||
|
||||
cmp #$0A
|
||||
bcs fetch_operator_failed // branch if $0A or greater
|
||||
|
||||
// Now we have to recognize '>=', '<=' and '<>' operators
|
||||
|
||||
cmp #$07
|
||||
beq fetch_operator_try_gteq
|
||||
|
||||
cmp #$09
|
||||
beq fetch_operator_try_lteq_neq
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
fetch_operator_success:
|
||||
|
||||
clc
|
||||
rts
|
||||
|
||||
fetch_operator_failed:
|
||||
|
||||
#if !HAS_OPCODES_65CE02
|
||||
jsr unconsume_character
|
||||
#else
|
||||
dew TXTPTR
|
||||
#endif
|
||||
|
||||
sec
|
||||
rts
|
||||
|
||||
|
||||
fetch_operator_try_gteq:
|
||||
|
||||
// Here we distinguish between '>' and '>='
|
||||
|
||||
jsr fetch_character
|
||||
cmp #$B2 // '='
|
||||
beq !+
|
||||
|
||||
// This is a '>'
|
||||
|
||||
#if !HAS_OPCODES_65CE02
|
||||
jsr unconsume_character
|
||||
#else
|
||||
dew TXTPTR
|
||||
#endif
|
||||
lda #$07
|
||||
bne fetch_operator_success // branch always
|
||||
!:
|
||||
// This is a '>='
|
||||
|
||||
lda #$0A
|
||||
bne fetch_operator_success // branch always
|
||||
|
||||
|
||||
fetch_operator_try_lteq_neq:
|
||||
|
||||
// Here we distinguish between '<', '<=', and '<>'
|
||||
|
||||
jsr fetch_character
|
||||
cmp #$B2 // '='
|
||||
beq !+
|
||||
cmp #$B1 // '>'
|
||||
beq !++
|
||||
|
||||
// This is a '<'
|
||||
|
||||
#if !HAS_OPCODES_65CE02
|
||||
jsr unconsume_character
|
||||
#else
|
||||
dew TXTPTR
|
||||
#endif
|
||||
lda #$09
|
||||
bne fetch_operator_success // branch always
|
||||
!:
|
||||
// This is a '<='
|
||||
|
||||
lda #$0B
|
||||
bne fetch_operator_success // branch always
|
||||
!:
|
||||
// This is a '<>'
|
||||
|
||||
lda #$0C
|
||||
bne fetch_operator_success // branch always
|
||||
Reference in new issue
Block a user