staresult_binary_base+1; set where to store resulting binary
stzbinary_subroutine_address
lda#$80
stabinary_subroutine_address+1; available subroutines start at $8000
jsrcompile_values
stp
; parser loop, eventually this will be able to handle longer program strings, but indexing by y is fine for now
compile_values:
ldy#0
parser_loop:
ldaprogram_text,y; get character at index
cmp#0; is eof?
beq.end; yes, exit loop
cmp#20; is space?
beqparser_loop; yes, skip this char
cmp#12; is newline?
beq.newline; yes, handle newline
jsrcompile_values_op
jsrcompile_values_nat
.newline:; we reached a newline, y is program string index
iny; WARN: don't accidentally iny in this loop w/out handling a character
ldaprogram_text,y; load next char
cmp#12; is newline?
bneparser_loop; no, keep parsing tokens
rts; yes, no more tokens in body (see syntax.md for info)
.end:
rts
; a holds character value, y program text index, only iny if you find a matching character & consume it
compile_values_op:
cmp#"+"; i personally think this syntax is really silly but whatever, one of these days i'm gonna write my own assembler and document everything cause vasm documentation is kinda terrible
bne.next
.is_plus:
lda#1
jsrstore_subroutine
rts
.next:
rts
; cmp #"!" ; commenting these out for now to handle a single simple case
; cmp #"&"
; cmp #"|"
; cmp #"-"
; cmp #"*"
; cmp #"/"
; cmp #"="
; cmp #">"
; cmp #"<"
; cmp #"#"
; a holds character value, y program text index, only iny if you find a matching character & consume it