Users browsing this thread: 1 Guest(s)
Expansion of Treasure Chest subroutine
07-15-2018, 07:56 AM
(This post was last modified: 07-15-2018, 08:03 AM by NPCnextdoor.)
Thanks!
I made the modifications. However, with
ASL $22
ROL $24
(And also removing the BCS INC_HIGH_BYTE1 operation)
It didn't work. The result was way too low. So I thought that perhaps ROL was 8-bit some how, even though the M flag is 0 (16-bit mode). So, I did
ASL $22
ROL $25
ROL $24
And the result was way too high. However,
ASL $22
ROL $25
Works perfectly! And I don't understand why.
I did try first this approach (well, when I learnt eventually about the ROL opcode ) and because of this weird behavior, I took another route that I knew would work until I understood it better. I concluded that if some operations directly on the data were somehow always 8-bit, I would prefer to put the values in the A, X or Y registers first and put the results back.
I made the modifications. However, with
ASL $22
ROL $24
(And also removing the BCS INC_HIGH_BYTE1 operation)
It didn't work. The result was way too low. So I thought that perhaps ROL was 8-bit some how, even though the M flag is 0 (16-bit mode). So, I did
ASL $22
ROL $25
ROL $24
And the result was way too high. However,
ASL $22
ROL $25
Works perfectly! And I don't understand why.
I did try first this approach (well, when I learnt eventually about the ROL opcode ) and because of this weird behavior, I took another route that I knew would work until I understood it better. I concluded that if some operations directly on the data were somehow always 8-bit, I would prefer to put the values in the A, X or Y registers first and put the results back.
« Next Oldest | Next Newest »
|
||||
Users browsing this thread: 1 Guest(s)