Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Assembly Language Programming (ALP) Forum (http://www.go4expert.com/forums/assembly-language-programming-forum/)
-   -   Very important please (http://www.go4expert.com/forums/very-important-please-t19573/)

valley 28Sep2009 02:57

Very important please
 
Write a program to sort a list of numbers for microprossecer 8051, The numbers will be stored in memory starting at data memory address 0x40. The list will be no more than 5 bytes long. The “end of list” byte will be 0xFF, and that value will not occur in the list of data.
What i did is that:

CSEG AT 20
?C_START:MOV A,0x40
CJNE A, #255, NOTEQUAL
jmp loop
NOTEQUAL: INC R3
MOV A,0x41
CJNE A, #255, NOTEQUAL2
jmp Final
NOTEQUAL2: INC R3
MOV A,0x42
CJNE A, #255, NOTEQUAL3
jmp Final
NOTEQUAL3: INC R3
MOV A,0x43
CJNE A, #255, NOTEQUAL4
jmp Final
NOTEQUAL4: INC R3
MOV A,0x44
CJNE A, #255, NOTEQUAL5
jmp Final
NOTEQUAL5: INC R3
Final: mov R0,#0x40
mov a,@R0
mov 0x60, a
INC R0
mov a, @R0
SUB a,0x60
JC Final

LOOP: ljmp loop
PUBLIC ?C_START
END

can you fixed it and where I make my mestake

xpi0t0s 28Sep2009 12:41

Re: Very important please
 
It can make it a lot easier if we know what kind of problem we're looking for.
Did the code assemble without warnings and errors? If not, what were they?
What does the program do wrong?
What input values did you give (i.e. what values did you place at 0x40)?
What was the result of running the code - was it partially sorted, not sorted at all, sorted in the wrong order, or did the program get stuck in an infinite loop or crash, or do something else weird?
Can you identify which line of code the program started going wrong?

Did you try dry running the code, executing the instructions one by one yourself as if you were the processor, keeping track of register and memory values with pen(cil) and paper?


All times are GMT +5.5. The time now is 02:00.