Users browsing this thread: 1 Guest(s)
Learning Magic
07-05-2012, 07:38 PM
Ok, so this is what I have so far... I think I need a little help understanding the accumulator and RAM operations.
**I am overwriting Gogo's code, its not going to get used anyway.**
So what I am expecting to happen is for it to use the remainder of the actor/12 (#$0C) to determine what spell to look at, not the raw actor number. The result I am actually getting is all of my actors are seeing the same random magic percentages, when I scroll down the list in the menu and come back up, some of the values disappear, while others change value.
I'm still new to assembly code and I think I have some fundamental misunderstanding of the registers, accumulator, and RAM. Since the values change when I move around, does that mean the numbers aren't staying consistent in the accumulator, if so, why would that be? Also, $4216 in the RAM is used for both the product of multipliers and the remainder from division... this code uses both, so if I have values in $4202, $4203, $4204, and $4205; what number would I expect to see in $4216? And finally, what is the difference between "MathValue" and "MathValue!" ?
Code:
C3/50A2: 85E0 STA $E0
C3/50A4: 20DD4E JSR $4EDD
C3/50A7: B90000 LDA $0000,Y
----------this is where my code starts-------------------------
C3/50AA: 8D0442 STA $4204 (Divider A)
C3/50AD: A90C LDA #$0C (12)
C3/50AF: 8D0542 STA $4205 (Divider B)
C3/50B2: AD1642 LDA 4216 (MathValue Math coprocessor's result. Remainder for Divisions)
----------this is where my code ends-------------------------
C3/50XX: 8D0242 STA $4202
C3/50XX: A936 LDA #$36
C3/50XX: 8D0342 STA $4203
C3/50XX: 7B TDC
C3/50XX: A5E0 LDA $E0
C3/50XX: C220 REP #$20 (16 bit memory/accum.)
C3/50XX: 6D1642 ADC $4216
C3/50XX: AA TAX
C3/50XX: E220 SEP #$20 (8 bit memory/accum.)
C3/50XX: BD6E1A LDA $1A6E,X
C3/50XX: 60 RTS
**I am overwriting Gogo's code, its not going to get used anyway.**
So what I am expecting to happen is for it to use the remainder of the actor/12 (#$0C) to determine what spell to look at, not the raw actor number. The result I am actually getting is all of my actors are seeing the same random magic percentages, when I scroll down the list in the menu and come back up, some of the values disappear, while others change value.
I'm still new to assembly code and I think I have some fundamental misunderstanding of the registers, accumulator, and RAM. Since the values change when I move around, does that mean the numbers aren't staying consistent in the accumulator, if so, why would that be? Also, $4216 in the RAM is used for both the product of multipliers and the remainder from division... this code uses both, so if I have values in $4202, $4203, $4204, and $4205; what number would I expect to see in $4216? And finally, what is the difference between "MathValue" and "MathValue!" ?
« Next Oldest | Next Newest »
|
||||
Users browsing this thread: 1 Guest(s)