Free space and code optimisation in Manic Miner
Posted 23 January 2019 - 12:00 AM
ATT15 equ $59e0 ; The attribute position of the piano, which is defined as line 15
; calculate the screen position to press a key based on "a" the note
LD HL,ATT15 ; this address is free to move up or down the screen
STEP2_INDEX: ;used by the delay routine
By "the delay routine", are you referring to some other part of your modified version of the program, which uses (in part) the common subroutine to extract data in a similar manner?
; byte 1 ------xxb the xxb value is an index into the TIME_SHIFT array. This supplies the note duration.
; byte 1 xxxxx---b the xxxxxxb value is an index into the NOTE_SHIFT array. this supplies the shift from the first note to the second note
; byte 1 -----x--b the xb value is unused in this data
As well as the spare bit that you identify, I think the highest bit is also spare, since there are only 16 entries in the NOTE_SHIFT table (which therefore only requires 4 bits)?
Edited by IRF, 23 January 2019 - 12:12 AM.
- Spider likes this
Posted 23 January 2019 - 01:29 PM
STEP2_INDEX: is/was used by another routine as you suggested.
The unused bits. The routine was written to encompass change in the data. So the length of each data table was selected to enable editing. 3 bits for time and five bits for pitch change. The subroutine contains an "AND 31" which is handy for the pitch change data. No point in adding another instruction somewhere just to reclaim the bit that is/was not used in the data.
The notes length still needed to have an "AND ?" added somewhere, and here I felt the editing of the data was unlikely to add longer notes. So "AND 3" was selected and then the additional bit was free. The point of including the statement that this is unused. Was to emphasize that the bit is available if wanted. and the "AND 3" can be changed to "AND 7" and additional note lengths can be added.
I can think of no use for the spare bits, apart from the what they were originally designated to be used for.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users