I cannot write Assembly code to save myself can someone write this for me please
I want to make a fast case statement as a standard case statement is way too slow for my project.
my project hangs on this centail peice of code.
Hear below I see how to do what I need and others may use the result too.

Procedure Procedure1;
begin
//..............
end;

Procedure Procedure2;
begin
//..............
end;

Procedure Procedure3;
begin
//..............
end;

Procedure Procedure4;
begin
//..............
end;

Procedure Procedure5;
begin
//..............
end;

const
Prolist: {packed} array [1..5{500}] of Pointer =
          (@Procedure1, @Procedure2, @Procedure3, @Procedure4, @Procedure5);

ASMCase(Prolist: array of Pointer; No: Word; Var InRange: Boolean);}

ASMCase takes size of Prolist <= (No * 4) and sets InRange accordingly
If valid, takes No * 4 + @Prolist[0] and runs procedure out of Prolist;
This saves time processing a ‘If’ Statement for every procedure.
The case statement may identify a Nil value in Prolist instead of a procedure call and not execute it;
I expect to have about 500 procedures from this case statement;

I do not think the code would be too big to write.

What assembler are you using? Since this looks more like Pascal than assembler, I am guessing HLA, but I am not familiar with it personally so that's at most a guess.

Syntactically, HLA works very differently from your average assembler, and I don't know who if anyone here is going to be familiar with it. Sorry.

@Schol-R-LEA - I'm guessing that HLA means "High Level Assembler"? IE, an abstract assembly language?

@lexd - real assembly languages are very processor dependent. x86 vs ARM vs Power-PC, vs Sparc, et al. FWIW, we don't do your homework for you. Post your efforts (code), errors that the compiler/assembler gives you, provide details of your programming environment, and we may be able to help you, but not at this point.

@rubberman: It's more like an assembler with a few elements of a high-level language added to it. While there have been several high level assemblers in the past, the one which is currently best known is the one actually called HLA, and used by the book The Art of Assembly, which can be found here. It is intended to make it easier for students to transition from high-level programming to low-level programming, but I am skeptical of this; it sounds like it would confuse students more than help.

OTOH, I'm not one to talk; I'm writing an assembler based on s-expressions and using hygienic macros for extensibility, so I do see the advantages of mixing low-level and high-level code, I just don't think of it in terms of a pedagogical tool.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.