This is my first try to write assembly code. I need to implement a code (using stack) that would determine how many negative numbers are in a give array. Currently what I have does not even come close to doing it (I am trying to go in small chunks), and among many things that I do not understand is why when I run the simulator, instead of executing PULX, the code does BGND. Is there something wrong in how I am doing the addressing?
What I am was trying to do is implement a loop that would look at each number in the array and implement a counter. I am getting lost in push/pull and branches...
Tnxs
What I am was trying to do is implement a loop that would look at each number in the array and implement a counter. I am getting lost in push/pull and branches...
Rich (BB code):
ORG PROGRAM_ADD
MAIN
LDS #STACK_ADD
LDAB #SIZE_ARRAY ;counter
LDX #ARRAY
BSR COUNTPOSITIVE
SWI
COUNTPOSITIVE
PSHX
LOOP
LDAA 0,X
BMI COUNT
STAA 1,X+
DBNE B,LOOP
COUNT
INCB
PULX