Skip to content

Commit

Permalink
Optimize EMIT_N parser instruction.
Browse files Browse the repository at this point in the history
  • Loading branch information
dmsc committed Feb 25, 2018
1 parent 7fbd848 commit 95c4c83
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions src/parse.asm
Original file line number Diff line number Diff line change
Expand Up @@ -264,17 +264,14 @@ ploop_nofetch:
.assert SM_RET = 1, error, "SM_RET must be 1"
beq pexit_ok
dex
.assert SM_ERET = 2, error, "SM_ERET must be 1"
.assert SM_ERET = 2, error, "SM_ERET must be 2"
beq pemit_ret

pemit_n:
clc
adc #($100 - SM_EMIT_1)
tax
.assert SM_EMIT_1 = 3, error, "SM_EMIT_1 must be 3"
: jsr emit_sub
dex
bpl :-
bmi ploop
bne :-
beq ploop

; Character match
match_char:
Expand Down Expand Up @@ -381,14 +378,12 @@ skip_nextline:
.assert SM_RET = 1, error, "SM_RET must be 1"
beq go_ploop
dex
.assert SM_ERET = 2, error, "SM_ERET must be 1"
.assert SM_ERET = 2, error, "SM_ERET must be 2"
beq skip_ret
clc
adc #($100 - SM_EMIT_1)
tax
.assert SM_EMIT_1 = 3, error, "SM_EMIT_1 must be 3"
: jsr parser_fetch ; Skip token
dex
bpl :-
bne :-
jmp skip_nextline
skip_ret:
jsr parser_fetch ; Skip token and RET
Expand Down

0 comments on commit 95c4c83

Please sign in to comment.