Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.
i need to subtract the number in $4031 from the number in $4030.
if the result is zero - store in $4032
if the result is negative - store in $4033
if the result is positive - store in $4034
I think you'd want to have lablels for your branches, and why do you use those stupid BRKs ? This will trigger an IRQ and skip the next byte once IRQ returns, wich is probably not what you want to do.
Assuming you're treating your numbers as signed... your code is conceptually correct -- but your branches are off (they're both 1 byte too much)
you'd want
beq $06
bmi $08
in this case. But you should use labels for this anyway to avoid these kinds of mistakes (and because it's just all around easier)
If you're treating your numbers as unsigned (ie: $FF is 255 and not -1), then this code will not quite work. You'd want a BCC instead of BMI in that case.
Also -- if the numbers on the left are supposed to be offsets, they're all wrong. (BMI takes two bytes, so if it is at $4009, STA $4034 would start at $400B, not $400A)
Plus... your address range is not typical for NES work. On the NES, $4000-$4017 is CPU/APU registers and the rest of $4xxx is generally open bus. So this isn't an area where you would ever have code or RAM.