Hi again!
Here I have a snippet of my routine for "converting" a tile into understandable hex chars and numbers.
One byte of input, in this example lets say a value of $C3, will be split up into two destination bytes with values $0C and $03.
This routine works without any customization in for example Super Mario Bros where the top row of right pattern table is in 0-F order.
So a output of these two bytes onto screen will now give the text "C3".
In case the 0-F tiles where put somewhere else, lets say starting at $A0, but where in correct order, it would be simple just adding $A0 to both destinations.
So, now for the question I have.
Let's say 0-9 where in correct order - lets say starting at $00 - but letters A-F where put somewhere else - lets say $40. That would mean a great deal of comparing values (in my mind atleast).
Any ideas? I already cheated a little to make it work by changing the pattern table. But that's not how I want to do now
Edit: Saw something duplictaed in my code..
Edit 2: Added a picture to clarify
Here I have a snippet of my routine for "converting" a tile into understandable hex chars and numbers.
One byte of input, in this example lets say a value of $C3, will be split up into two destination bytes with values $0C and $03.
This routine works without any customization in for example Super Mario Bros where the top row of right pattern table is in 0-F order.
So a output of these two bytes onto screen will now give the text "C3".
Code:
LDA $input
ROR
ROR
ROR
ROR
AND #$0F
STA $firstbyte_output
LDA $input
ROL
ROR
and #$0f 'here be black magic ;)
STA $secondbyte_output
ROR
ROR
ROR
ROR
AND #$0F
STA $firstbyte_output
LDA $input
ROL
ROR
and #$0f 'here be black magic ;)
STA $secondbyte_output
In case the 0-F tiles where put somewhere else, lets say starting at $A0, but where in correct order, it would be simple just adding $A0 to both destinations.
So, now for the question I have.
Let's say 0-9 where in correct order - lets say starting at $00 - but letters A-F where put somewhere else - lets say $40. That would mean a great deal of comparing values (in my mind atleast).
Any ideas? I already cheated a little to make it work by changing the pattern table. But that's not how I want to do now
Edit: Saw something duplictaed in my code..
Edit 2: Added a picture to clarify