Hello evrybody, i'm an electronic engineering student and this tearm we had microprocessor and use of assembly to program them. They gave us five exercise to complete and write a portolio about it. I could manage to do 4 of them but i realy can't do anything about the last one. The program is to get 6 numbers from keyboard and arrange the squence in the descending order, like

List    DC.B    1 3 4 4 6 8

output: 864431

I would realy appreciate if somebody help me with this or give me a link to this code

Posted on 2009-02-14 05:47:18 by zockex
Oh bytheway im using motorola 68k
Posted on 2009-02-14 06:24:45 by zockex
50 view and no answer to this simple question (offcourse simple for u guys with all those advanced topics going around here ). Please help me. i have to hand in my work in next 2 days
Posted on 2009-02-16 16:35:31 by zockex
The majority of us have coded only in x86 asm. So, you need patience to wait for the guys that know 68k and the needed interrupts/calls for the OS to come and see this thread.
Or, you can paste the code of your previous assignments, specify the cpu ISA version of 68k you're using, and wait for us a bit to whip-up the solution. (pasting your code will give us some pointers which calls/interruptss to use, etc - instead of making us learn all ISA versions and ABI).
Posted on 2009-02-16 19:25:37 by Ultrano
Wait, What? I dont know about ISA n FBI and CPU and DSI stuff guys  :shock: but here is the code for my previous job which gets 6 input from keyboard and print them from the last one to the first one ( without checking them and comparing them and arranging them in ascending order)


START ORG $1000

BS  EQU  $08    Backspace
HT  EQU  $09    Tab (horizontal 5 characters)
LF  EQU  $0A    New line (line feed)
VT  EQU  $0C    Vertical tab (4 lines)
FF  EQU  $0C    Form feed (Always end printing with form feed.)
CR  EQU  $0D    Carriage Return

*Code to display a message
MOVE.B #0,D2
LEA NUMS,A2

LOOP LEA Message,A1 *Loads the address of MESSAGE into adreess register A1
MOVE.B  #14,D0 *Moves the number 14 into a data register DO to select IQ task 14
TRAP #15

*Code to read an input from the keyboard and exit if it is a 10
MOVE.B  #4,D0
TRAP #15
MOVE.B D1,(A2)
ADD.L #1,A2
ADD.B #1,D2
CMP.L #10,D2
BNE LOOP

LOOP2 SUB.L #1,A2
MOVE.B (A2),D1
MOVE.B #3,D0
TRAP #15
MOVE.B #$2C,D1
MOVE #6,D0
TRAP #15
SUB #1,D2
CMP.L #0,D2
BNE LOOP2

*Code to make sure the simulator does not try to execute the message!

DONE MOVE.B #9,D0
TRAP #15 Halt simulator

MESSAGE DC.B 'Please enter a number: ',0 *The message
NUMS DS.B 10
END START
Posted on 2009-02-17 10:47:31 by zockex
You just need order these number:
For (i=1;i<=6;i++)
{
Value, No. = Max{nums}; //Use For (j=i;j<=6;j++) ....
Swap (,)
}

============================
  BNE  LOOP
  * Insert the codes here
LOOP2  SUB.L  #1,A2
============================
------------------------------------
LEA NUMS,A1 * Data Addr
MOVE.B #0,D0 * temp varible value
MOVE.B #0,A2 * temp varible No. (addr)
MOVE.B #0,D1 * varible i
MOVE.B #0,D2 * varible j
------------------------------------

* from your code, I just know BNE is for jumping with A!=B in CMP.
* Are BL xxx,BA xxx... valid codes?
* I just give you the method.
* You'd better write the code by yourself.
* Thank you.
Posted on 2009-02-26 23:54:32 by asmdna