Welcome, Guest. Please login or register.

Author Topic: Programming question! :)  (Read 3408 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline smerf

  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 1666
    • Show all replies
Re: Programming question! :)
« on: April 17, 2012, 02:53:09 AM »
Quote from: bloodline;688783
I have a list that I want to compare a value against to determine the value's "rank", the problem is that once I have determined the rank I wish to end the search... In ASM this is easy (please bare with my half remembered 68k):
Code: [Select]


_start  move.l _number,d0
          cmpi.l #4185,d0
          blt.s _case4184
          cmpi.l #4507,d0
          blt.s _case4507
          cmpi.l #4883,d0
          blt.s _case4883
          cmpi.l #5327,d0
          blt.s _case5327
          move.l 0,d0
_break

           rts

_case4185
           move.l #4,d0
           jmp _break

_case4507
           move.l #3,d0
           jmp _break

_case4883
           move.l #2,d0
           jmp _break

_case5327
           move.l #1,d0
           jmp _break


But I want to write this in C... Suffice to say the actual list is much larger and CPU time is at a premium, is there any way I can write it without using Goto?


Hi,

This is quite simple, just go to kings Knight pawn, and move two to the left, not forgetting to move queen pawn two spaces to the right, and then you get
checkmate.

If you figured out that I don't have a clue to what your talking about, it means that you are 10 times smarter than the average person here at Amiga.org

:-)

smerf
I have no idea what your talking about, so here is a doggy with a small pancake on his head.

MorphOS is a MAC done a little better