EgonOlsen71 / basicv2

A Commodore (CBM) BASIC V2 interpreter/compiler written in Java
https://egonolsen71.github.io/basicv2/
The Unlicense
84 stars 15 forks source link

shorten INITNARRAY subroutine #25

Closed nippur72 closed 5 years ago

nippur72 commented 5 years ago

In the INITNARRAY subroutine, decrementing TMP2_ZP by one can be done more efficiently with DEC instead of SBC #1 (recipe taken from here -- section "Incrementing & Decrementing").

This in turn shortens also the "is-zero" check after NLOOPNOV2 (no LDA before BNE).

I also used the X register within the loop in order to avoid setting A to 0 at each iteration.

I haven't tested it (can't build)

EgonOlsen71 commented 5 years ago

I've struggled with merging this one, because this routine doesn't have to be optimized IMO and I found the former code better readable...but screw it...I appreciate the contribution, so I merged it anyway...:-)

BTW: Why can't you build it yourself? An Eclipse install with Maven support should be enough to build it.